From 0110b82c520276695dc2c6391ab8aa85269dffba Mon Sep 17 00:00:00 2001 From: Thibault Deckers Date: Mon, 12 Oct 2020 11:56:42 +0900 Subject: [PATCH] use new Material buttons --- lib/main.dart | 15 +++++++++++++ .../action_delegates/add_shortcut_dialog.dart | 4 ++-- .../action_delegates/create_album_dialog.dart | 4 ++-- .../entry_action_delegate.dart | 4 ++-- .../action_delegates/permission_aware.dart | 4 ++-- .../action_delegates/rename_album_dialog.dart | 4 ++-- .../action_delegates/rename_entry_dialog.dart | 4 ++-- .../selection_action_delegate.dart | 4 ++-- lib/widgets/common/aves_selection_dialog.dart | 2 +- lib/widgets/debug_page.dart | 22 +++++++++---------- .../common/chip_action_delegate.dart | 4 ++-- lib/widgets/fullscreen/debug.dart | 2 +- lib/widgets/settings/access_grants.dart | 4 ++-- lib/widgets/welcome_page.dart | 2 +- 14 files changed, 47 insertions(+), 32 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 3d4165dd2..7ccf819e1 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -65,6 +65,21 @@ class _AvesAppState extends State { ), ), ), + elevatedButtonTheme: ElevatedButtonThemeData( + style: ElevatedButton.styleFrom( + primary: accentColor, + ), + ), + outlinedButtonTheme: OutlinedButtonThemeData( + style: OutlinedButton.styleFrom( + primary: accentColor, + ), + ), + textButtonTheme: TextButtonThemeData( + style: TextButton.styleFrom( + primary: Colors.white, + ), + ), ); Widget get firstPage => settings.hasAcceptedTerms ? HomePage() : WelcomePage(); diff --git a/lib/widgets/common/action_delegates/add_shortcut_dialog.dart b/lib/widgets/common/action_delegates/add_shortcut_dialog.dart index 7274c273e..f17316720 100644 --- a/lib/widgets/common/action_delegates/add_shortcut_dialog.dart +++ b/lib/widgets/common/action_delegates/add_shortcut_dialog.dart @@ -48,14 +48,14 @@ class _AddShortcutDialogState extends State { onSubmitted: (_) => _submit(context), ), actions: [ - FlatButton( + TextButton( onPressed: () => Navigator.pop(context), child: Text('Cancel'.toUpperCase()), ), ValueListenableBuilder( valueListenable: _isValidNotifier, builder: (context, isValid, child) { - return FlatButton( + return TextButton( onPressed: isValid ? () => _submit(context) : null, child: Text('Add'.toUpperCase()), ); diff --git a/lib/widgets/common/action_delegates/create_album_dialog.dart b/lib/widgets/common/action_delegates/create_album_dialog.dart index 6d9d394c6..498bb4edf 100644 --- a/lib/widgets/common/action_delegates/create_album_dialog.dart +++ b/lib/widgets/common/action_delegates/create_album_dialog.dart @@ -92,14 +92,14 @@ class _CreateAlbumDialogState extends State { ), ], actions: [ - FlatButton( + TextButton( onPressed: () => Navigator.pop(context), child: Text('Cancel'.toUpperCase()), ), ValueListenableBuilder( valueListenable: _isValidNotifier, builder: (context, isValid, child) { - return FlatButton( + return TextButton( onPressed: isValid ? () => _submit(context) : null, child: Text('Create'.toUpperCase()), ); diff --git a/lib/widgets/common/action_delegates/entry_action_delegate.dart b/lib/widgets/common/action_delegates/entry_action_delegate.dart index febec6329..8fc2fdb71 100644 --- a/lib/widgets/common/action_delegates/entry_action_delegate.dart +++ b/lib/widgets/common/action_delegates/entry_action_delegate.dart @@ -127,11 +127,11 @@ class EntryActionDelegate with FeedbackMixin, PermissionAwareMixin { return AvesDialog( content: Text('Are you sure?'), actions: [ - FlatButton( + TextButton( onPressed: () => Navigator.pop(context), child: Text('Cancel'.toUpperCase()), ), - FlatButton( + TextButton( onPressed: () => Navigator.pop(context, true), child: Text('Delete'.toUpperCase()), ), diff --git a/lib/widgets/common/action_delegates/permission_aware.dart b/lib/widgets/common/action_delegates/permission_aware.dart index b020c627e..18ba08630 100644 --- a/lib/widgets/common/action_delegates/permission_aware.dart +++ b/lib/widgets/common/action_delegates/permission_aware.dart @@ -28,11 +28,11 @@ mixin PermissionAwareMixin { title: 'Storage Volume Access', content: Text('Please select the $dirDisplayName directory of “$volumeDescription” in the next screen, so that this app can access it and complete your request.'), actions: [ - FlatButton( + TextButton( onPressed: () => Navigator.pop(context), child: Text('Cancel'.toUpperCase()), ), - FlatButton( + TextButton( onPressed: () => Navigator.pop(context, true), child: Text('OK'.toUpperCase()), ), diff --git a/lib/widgets/common/action_delegates/rename_album_dialog.dart b/lib/widgets/common/action_delegates/rename_album_dialog.dart index 99bd36467..7679fb620 100644 --- a/lib/widgets/common/action_delegates/rename_album_dialog.dart +++ b/lib/widgets/common/action_delegates/rename_album_dialog.dart @@ -54,14 +54,14 @@ class _RenameAlbumDialogState extends State { ); }), actions: [ - FlatButton( + TextButton( onPressed: () => Navigator.pop(context), child: Text('Cancel'.toUpperCase()), ), ValueListenableBuilder( valueListenable: _isValidNotifier, builder: (context, isValid, child) { - return FlatButton( + return TextButton( onPressed: isValid ? () => _submit(context) : null, child: Text('Apply'.toUpperCase()), ); diff --git a/lib/widgets/common/action_delegates/rename_entry_dialog.dart b/lib/widgets/common/action_delegates/rename_entry_dialog.dart index 3fbd6f52d..87d258fc5 100644 --- a/lib/widgets/common/action_delegates/rename_entry_dialog.dart +++ b/lib/widgets/common/action_delegates/rename_entry_dialog.dart @@ -48,14 +48,14 @@ class _RenameEntryDialogState extends State { onSubmitted: (_) => _submit(context), ), actions: [ - FlatButton( + TextButton( onPressed: () => Navigator.pop(context), child: Text('Cancel'.toUpperCase()), ), ValueListenableBuilder( valueListenable: _isValidNotifier, builder: (context, isValid, child) { - return FlatButton( + return TextButton( onPressed: isValid ? () => _submit(context) : null, child: Text('Apply'.toUpperCase()), ); diff --git a/lib/widgets/common/action_delegates/selection_action_delegate.dart b/lib/widgets/common/action_delegates/selection_action_delegate.dart index 0c5788712..6c1dda456 100644 --- a/lib/widgets/common/action_delegates/selection_action_delegate.dart +++ b/lib/widgets/common/action_delegates/selection_action_delegate.dart @@ -148,11 +148,11 @@ class SelectionActionDelegate with FeedbackMixin, PermissionAwareMixin { return AvesDialog( content: Text('Are you sure you want to delete ${Intl.plural(count, one: 'this item', other: 'these $count items')}?'), actions: [ - FlatButton( + TextButton( onPressed: () => Navigator.pop(context), child: Text('Cancel'.toUpperCase()), ), - FlatButton( + TextButton( onPressed: () => Navigator.pop(context, true), child: Text('Delete'.toUpperCase()), ), diff --git a/lib/widgets/common/aves_selection_dialog.dart b/lib/widgets/common/aves_selection_dialog.dart index 1932866ae..5c32ca2e6 100644 --- a/lib/widgets/common/aves_selection_dialog.dart +++ b/lib/widgets/common/aves_selection_dialog.dart @@ -38,7 +38,7 @@ class _AvesSelectionDialogState extends State { title: widget.title, scrollableContent: widget.options.entries.map((kv) => _buildRadioListTile(kv.key, kv.value)).toList(), actions: [ - FlatButton( + TextButton( onPressed: () => Navigator.pop(context), child: Text('Cancel'.toUpperCase()), ), diff --git a/lib/widgets/debug_page.dart b/lib/widgets/debug_page.dart index 15399f7ce..e9f1ab721 100644 --- a/lib/widgets/debug_page.dart +++ b/lib/widgets/debug_page.dart @@ -103,7 +103,7 @@ class DebugPageState extends State { child: Text('Crashlytics'), ), SizedBox(width: 8), - RaisedButton( + ElevatedButton( onPressed: FirebaseCrashlytics.instance.crash, child: Text('Crash'), ), @@ -123,7 +123,7 @@ class DebugPageState extends State { child: Text('Image cache:\n\t${imageCache.currentSize}/${imageCache.maximumSize} items\n\t${formatFilesize(imageCache.currentSizeBytes)}/${formatFilesize(imageCache.maximumSizeBytes)}'), ), SizedBox(width: 8), - RaisedButton( + ElevatedButton( onPressed: () { imageCache.clear(); setState(() {}); @@ -138,7 +138,7 @@ class DebugPageState extends State { child: Text('SVG cache: ${PictureProvider.cacheCount} items'), ), SizedBox(width: 8), - RaisedButton( + ElevatedButton( onPressed: () { PictureProvider.clearCache(); setState(() {}); @@ -153,7 +153,7 @@ class DebugPageState extends State { child: Text('Glide disk cache: ?'), ), SizedBox(width: 8), - RaisedButton( + ElevatedButton( onPressed: ImageFileService.clearSizedThumbnailDiskCache, child: Text('Clear'), ), @@ -171,7 +171,7 @@ class DebugPageState extends State { child: Text('DB file size: ${formatFilesize(snapshot.data)}'), ), SizedBox(width: 8), - RaisedButton( + ElevatedButton( onPressed: () => metadataDb.reset().then((_) => _startDbReport()), child: Text('Reset'), ), @@ -190,7 +190,7 @@ class DebugPageState extends State { child: Text('DB entry rows: ${snapshot.data.length}'), ), SizedBox(width: 8), - RaisedButton( + ElevatedButton( onPressed: () => metadataDb.clearEntries().then((_) => _startDbReport()), child: Text('Clear'), ), @@ -209,7 +209,7 @@ class DebugPageState extends State { child: Text('DB date rows: ${snapshot.data.length}'), ), SizedBox(width: 8), - RaisedButton( + ElevatedButton( onPressed: () => metadataDb.clearDates().then((_) => _startDbReport()), child: Text('Clear'), ), @@ -228,7 +228,7 @@ class DebugPageState extends State { child: Text('DB metadata rows: ${snapshot.data.length}'), ), SizedBox(width: 8), - RaisedButton( + ElevatedButton( onPressed: () => metadataDb.clearMetadataEntries().then((_) => _startDbReport()), child: Text('Clear'), ), @@ -247,7 +247,7 @@ class DebugPageState extends State { child: Text('DB address rows: ${snapshot.data.length}'), ), SizedBox(width: 8), - RaisedButton( + ElevatedButton( onPressed: () => metadataDb.clearAddresses().then((_) => _startDbReport()), child: Text('Clear'), ), @@ -266,7 +266,7 @@ class DebugPageState extends State { child: Text('DB favourite rows: ${snapshot.data.length} (${favourites.count} in memory)'), ), SizedBox(width: 8), - RaisedButton( + ElevatedButton( onPressed: () => favourites.clear().then((_) => _startDbReport()), child: Text('Clear'), ), @@ -288,7 +288,7 @@ class DebugPageState extends State { child: Text('Settings'), ), SizedBox(width: 8), - RaisedButton( + ElevatedButton( onPressed: () => settings.reset().then((_) => setState(() {})), child: Text('Reset'), ), diff --git a/lib/widgets/filter_grids/common/chip_action_delegate.dart b/lib/widgets/filter_grids/common/chip_action_delegate.dart index d20e479de..135443064 100644 --- a/lib/widgets/filter_grids/common/chip_action_delegate.dart +++ b/lib/widgets/filter_grids/common/chip_action_delegate.dart @@ -65,11 +65,11 @@ class AlbumChipActionDelegate extends ChipActionDelegate with FeedbackMixin, Per return AvesDialog( content: Text('Are you sure you want to delete this album and its ${Intl.plural(count, one: 'item', other: '$count items')}?'), actions: [ - FlatButton( + TextButton( onPressed: () => Navigator.pop(context), child: Text('Cancel'.toUpperCase()), ), - FlatButton( + TextButton( onPressed: () => Navigator.pop(context, true), child: Text('Delete'.toUpperCase()), ), diff --git a/lib/widgets/fullscreen/debug.dart b/lib/widgets/fullscreen/debug.dart index 03d7ebebc..0bb1a73a2 100644 --- a/lib/widgets/fullscreen/debug.dart +++ b/lib/widgets/fullscreen/debug.dart @@ -176,7 +176,7 @@ class _FullscreenDebugPageState extends State { child: Text('DB'), ), SizedBox(width: 8), - RaisedButton( + ElevatedButton( onPressed: () async { await metadataDb.removeIds([entry.contentId]); _loadDatabase(); diff --git a/lib/widgets/settings/access_grants.dart b/lib/widgets/settings/access_grants.dart index 69e03ade7..a58a588c7 100644 --- a/lib/widgets/settings/access_grants.dart +++ b/lib/widgets/settings/access_grants.dart @@ -46,13 +46,13 @@ class _GrantedDirectoriesState extends State { children: [ Expanded(child: Text(path, style: textTheme.caption)), SizedBox(width: 8), - OutlineButton( + OutlinedButton( onPressed: () async { await AndroidFileService.revokeDirectoryAccess(path); _load(); setState(() {}); }, - child: Text('Revoke'), + child: Text('Revoke'.toUpperCase()), ), ], )), diff --git a/lib/widgets/welcome_page.dart b/lib/widgets/welcome_page.dart index bbe6be436..31a6921c1 100644 --- a/lib/widgets/welcome_page.dart +++ b/lib/widgets/welcome_page.dart @@ -110,7 +110,7 @@ class _WelcomePageState extends State { ], ); - final button = RaisedButton( + final button = ElevatedButton( key: Key('continue-button'), child: Text('Continue'), onPressed: _hasAcceptedTerms