From dad9e914083aee2e437fc2161cb53c46197c81d0 Mon Sep 17 00:00:00 2001 From: Efrain Date: Sat, 29 Jan 2022 14:52:59 -0500 Subject: [PATCH] [Presentation] Minor fixes and improvements --- lib/presentation/shared/bullet_list.dart | 33 +++++++++++++------ .../shared/character_stack_image.dart | 4 ++- .../two_column_enum_selector_dialog.dart | 27 +++++++++------ lib/presentation/tierlist/tier_list_page.dart | 8 ++++- 4 files changed, 50 insertions(+), 22 deletions(-) diff --git a/lib/presentation/shared/bullet_list.dart b/lib/presentation/shared/bullet_list.dart index a623ac426..05677cfb2 100644 --- a/lib/presentation/shared/bullet_list.dart +++ b/lib/presentation/shared/bullet_list.dart @@ -11,6 +11,7 @@ class BulletList extends StatelessWidget { final double fontSize; final Function(int)? onDelete; final EdgeInsets padding; + final bool addTooltip; const BulletList({ Key? key, @@ -21,6 +22,7 @@ class BulletList extends StatelessWidget { this.fontSize = 11, this.onDelete, this.padding = Styles.edgeInsetAll5, + this.addTooltip = true, }) : super(key: key); @override @@ -38,6 +40,7 @@ class BulletList extends StatelessWidget { iconResolver: iconResolver, onDelete: onDelete, padding: padding, + addTooltip: addTooltip, ), ) .toList(), @@ -54,6 +57,7 @@ class _ListItem extends StatelessWidget { final double fontSize; final Function(int)? onDelete; final EdgeInsets padding; + final bool addTooltip; const _ListItem({ Key? key, @@ -65,6 +69,7 @@ class _ListItem extends StatelessWidget { required this.fontSize, this.onDelete, required this.padding, + required this.addTooltip, }) : super(key: key); @override @@ -78,16 +83,24 @@ class _ListItem extends StatelessWidget { children: [ if (iconResolver != null) iconResolver!(index) else Icon(icon, size: iconSize), Expanded( - child: Tooltip( - message: title, - child: Container( - margin: const EdgeInsets.only(left: 5), - child: Text( - title, - style: theme.textTheme.bodyText2!.copyWith(fontSize: fontSize), - ), - ), - ), + child: addTooltip + ? Tooltip( + message: title, + child: Container( + margin: const EdgeInsets.only(left: 5), + child: Text( + title, + style: theme.textTheme.bodyText2!.copyWith(fontSize: fontSize), + ), + ), + ) + : Container( + margin: const EdgeInsets.only(left: 5), + child: Text( + title, + style: theme.textTheme.bodyText2!.copyWith(fontSize: fontSize), + ), + ), ), if (onDelete != null) InkWell( diff --git a/lib/presentation/shared/character_stack_image.dart b/lib/presentation/shared/character_stack_image.dart index aa38f4ef9..bc2d0713c 100644 --- a/lib/presentation/shared/character_stack_image.dart +++ b/lib/presentation/shared/character_stack_image.dart @@ -9,6 +9,7 @@ class CharacterStackImage extends StatelessWidget { final int rarity; final double height; final Function? onTap; + final BoxFit fit; const CharacterStackImage({ Key? key, @@ -17,6 +18,7 @@ class CharacterStackImage extends StatelessWidget { required this.rarity, this.onTap, this.height = 280, + this.fit = BoxFit.fitHeight, }) : super(key: key); @override @@ -31,7 +33,7 @@ class CharacterStackImage extends StatelessWidget { FadeInImage( placeholder: MemoryImage(kTransparentImage), height: height, - fit: BoxFit.fitHeight, + fit: fit, image: AssetImage(image), ), Container( diff --git a/lib/presentation/shared/dialogs/two_column_enum_selector_dialog.dart b/lib/presentation/shared/dialogs/two_column_enum_selector_dialog.dart index d58dfc1b6..6f84582ad 100644 --- a/lib/presentation/shared/dialogs/two_column_enum_selector_dialog.dart +++ b/lib/presentation/shared/dialogs/two_column_enum_selector_dialog.dart @@ -80,15 +80,20 @@ class _TwoColumnEnumSelectorDialogState extends State extends State extends State extends State= _selected.length) { + if (updatedNewIndex >= _selected.length || updatedNewIndex > 0) { updatedNewIndex--; } if (updatedNewIndex < 0) { diff --git a/lib/presentation/tierlist/tier_list_page.dart b/lib/presentation/tierlist/tier_list_page.dart index 53480798e..4bb50ad81 100644 --- a/lib/presentation/tierlist/tier_list_page.dart +++ b/lib/presentation/tierlist/tier_list_page.dart @@ -7,6 +7,7 @@ import 'package:shiori/application/bloc.dart'; import 'package:shiori/domain/extensions/iterable_extensions.dart'; import 'package:shiori/generated/l10n.dart'; import 'package:shiori/injection.dart'; +import 'package:shiori/presentation/shared/styles.dart'; import 'package:shiori/presentation/shared/utils/toast_utils.dart'; import 'package:shiori/presentation/tierlist/widgets/tierlist_fab.dart'; import 'package:shiori/presentation/tierlist/widgets/tierlist_row.dart'; @@ -75,6 +76,7 @@ class _AppBar extends StatelessWidget implements PreferredSizeWidget { Tooltip( message: s.confirm, child: IconButton( + splashRadius: Styles.mediumButtonSplashRadius, icon: const Icon(Icons.check), onPressed: () => ctx.read().add(const TierListEvent.readyToSave(ready: true)), ), @@ -83,6 +85,7 @@ class _AppBar extends StatelessWidget implements PreferredSizeWidget { Tooltip( message: s.clearAll, child: IconButton( + splashRadius: Styles.mediumButtonSplashRadius, icon: const Icon(Icons.clear_all), onPressed: () => context.read().add(const TierListEvent.clearAllRows()), ), @@ -91,6 +94,7 @@ class _AppBar extends StatelessWidget implements PreferredSizeWidget { Tooltip( message: s.restore, child: IconButton( + splashRadius: Styles.mediumButtonSplashRadius, icon: const Icon(Icons.settings_backup_restore_sharp), onPressed: () => context.read().add(const TierListEvent.init(reset: true)), ), @@ -99,7 +103,8 @@ class _AppBar extends StatelessWidget implements PreferredSizeWidget { Tooltip( message: s.save, child: IconButton( - icon: const Icon(Icons.save), + splashRadius: Styles.mediumButtonSplashRadius, + icon: const Icon(Icons.save_alt), onPressed: () => _takeScreenshot(context), ), ), @@ -107,6 +112,7 @@ class _AppBar extends StatelessWidget implements PreferredSizeWidget { Tooltip( message: s.cancel, child: IconButton( + splashRadius: Styles.mediumButtonSplashRadius, icon: const Icon(Icons.undo), onPressed: () => context.read().add(const TierListEvent.readyToSave(ready: false)), ),