-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from Flutterando/5-feature-mass-import-artwork
feat: Create Cover Settings
- Loading branch information
Showing
23 changed files
with
550 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<paths> | ||
<external-path name="external_files" path="."/> | ||
</paths> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
lib/app/(public)/config/widgets/cover_settings_widget.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import 'dart:ffi'; | ||
|
||
import 'package:asp/asp.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:gap/gap.dart'; | ||
import 'package:localization/localization.dart'; | ||
|
||
import '../../../interactor/actions/config_action.dart'; | ||
import '../../../interactor/actions/platform_action.dart'; | ||
import '../../../interactor/atoms/config_atom.dart'; | ||
|
||
class CoverSettingsWidget extends StatelessWidget { | ||
const CoverSettingsWidget({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final theme = Theme.of(context); | ||
return RxBuilder( | ||
builder: (context) { | ||
return Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Text( | ||
'cover'.i18n(), | ||
style: theme.textTheme.titleMedium, | ||
), | ||
const Gap(12), | ||
SwitchListTile( | ||
value: gameConfigState.value.enableIGDB, | ||
onChanged: (v) { | ||
saveConfig(gameConfigState.value.copyWith(enableIGDB: v)); | ||
}, | ||
title: const Text('IGDB'), | ||
), | ||
const Gap(18), | ||
Text( | ||
'import_covers'.i18n(), | ||
style: theme.textTheme.titleMedium, | ||
), | ||
const Gap(12), | ||
Padding( | ||
padding: const EdgeInsets.only(right: 20), | ||
child: TextFormField( | ||
key: Key(beautifyPath(gameConfigState.value.coverFolder ?? '')), | ||
decoration: InputDecoration( | ||
border: const OutlineInputBorder(), | ||
labelText: 'folder'.i18n(), | ||
suffixIcon: const Icon(Icons.folder), | ||
), | ||
initialValue: | ||
beautifyPath(gameConfigState.value.coverFolder ?? ''), | ||
readOnly: true, | ||
onTap: () async { | ||
final selectedDirectory = await getDirectory(); | ||
|
||
if (selectedDirectory != null) { | ||
saveConfig( | ||
gameConfigState.value.copyWith( | ||
coverFolder: selectedDirectory, | ||
), | ||
); | ||
} | ||
}, | ||
), | ||
), | ||
const Gap(12), | ||
Text( | ||
'import_covers_description'.i18n(), | ||
style: theme.textTheme.titleSmall, | ||
), | ||
], | ||
); | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.