Skip to content

Commit

Permalink
[Presentation] Minor fixes and improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfteam committed Jan 29, 2022
1 parent f7576d9 commit dad9e91
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 22 deletions.
33 changes: 23 additions & 10 deletions lib/presentation/shared/bullet_list.dart
Expand Up @@ -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,
Expand All @@ -21,6 +22,7 @@ class BulletList extends StatelessWidget {
this.fontSize = 11,
this.onDelete,
this.padding = Styles.edgeInsetAll5,
this.addTooltip = true,
}) : super(key: key);

@override
Expand All @@ -38,6 +40,7 @@ class BulletList extends StatelessWidget {
iconResolver: iconResolver,
onDelete: onDelete,
padding: padding,
addTooltip: addTooltip,
),
)
.toList(),
Expand All @@ -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,
Expand All @@ -65,6 +69,7 @@ class _ListItem extends StatelessWidget {
required this.fontSize,
this.onDelete,
required this.padding,
required this.addTooltip,
}) : super(key: key);

@override
Expand All @@ -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(
Expand Down
4 changes: 3 additions & 1 deletion lib/presentation/shared/character_stack_image.dart
Expand Up @@ -9,6 +9,7 @@ class CharacterStackImage extends StatelessWidget {
final int rarity;
final double height;
final Function? onTap;
final BoxFit fit;

const CharacterStackImage({
Key? key,
Expand All @@ -17,6 +18,7 @@ class CharacterStackImage extends StatelessWidget {
required this.rarity,
this.onTap,
this.height = 280,
this.fit = BoxFit.fitHeight,
}) : super(key: key);

@override
Expand All @@ -31,7 +33,7 @@ class CharacterStackImage extends StatelessWidget {
FadeInImage(
placeholder: MemoryImage(kTransparentImage),
height: height,
fit: BoxFit.fitHeight,
fit: fit,
image: AssetImage(image),
),
Container(
Expand Down
Expand Up @@ -80,15 +80,20 @@ class _TwoColumnEnumSelectorDialogState<TEnum> extends State<TwoColumnEnumSelect
children: [
Text(widget.title),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text(
widget.leftTitle,
style: theme.textTheme.subtitle1,
Expanded(
child: Text(
widget.leftTitle,
textAlign: TextAlign.center,
style: theme.textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold),
),
),
Text(
'${widget.rightTitle} (${_selected.length} / ${widget.maxNumberOfSelections})',
style: theme.textTheme.subtitle1,
Expanded(
child: Text(
'${widget.rightTitle} (${_selected.length} / ${widget.maxNumberOfSelections})',
textAlign: TextAlign.center,
style: theme.textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold),
),
),
],
),
Expand Down Expand Up @@ -165,7 +170,8 @@ class _TwoColumnEnumSelectorDialogState<TEnum> extends State<TwoColumnEnumSelect
children: [
Text(
widget.leftTitle,
style: theme.textTheme.subtitle1,
textAlign: TextAlign.center,
style: theme.textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold),
),
Container(
height: dialogHeight / 3,
Expand Down Expand Up @@ -197,7 +203,8 @@ class _TwoColumnEnumSelectorDialogState<TEnum> extends State<TwoColumnEnumSelect
),
Text(
'${widget.rightTitle} (${_selected.length} / ${widget.maxNumberOfSelections})',
style: theme.textTheme.subtitle1,
textAlign: TextAlign.center,
style: theme.textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold),
),
if (_selected.isNotEmpty)
Container(
Expand Down Expand Up @@ -248,7 +255,7 @@ class _TwoColumnEnumSelectorDialogState<TEnum> extends State<TwoColumnEnumSelect
void _onReorder(int oldIndex, int newIndex) {
final item = _selected.elementAt(oldIndex);
int updatedNewIndex = newIndex;
if (updatedNewIndex >= _selected.length) {
if (updatedNewIndex >= _selected.length || updatedNewIndex > 0) {
updatedNewIndex--;
}
if (updatedNewIndex < 0) {
Expand Down
8 changes: 7 additions & 1 deletion lib/presentation/tierlist/tier_list_page.dart
Expand Up @@ -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';
Expand Down Expand Up @@ -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<TierListBloc>().add(const TierListEvent.readyToSave(ready: true)),
),
Expand All @@ -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<TierListBloc>().add(const TierListEvent.clearAllRows()),
),
Expand All @@ -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<TierListBloc>().add(const TierListEvent.init(reset: true)),
),
Expand All @@ -99,14 +103,16 @@ 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),
),
),
if (state.readyToSave)
Tooltip(
message: s.cancel,
child: IconButton(
splashRadius: Styles.mediumButtonSplashRadius,
icon: const Icon(Icons.undo),
onPressed: () => context.read<TierListBloc>().add(const TierListEvent.readyToSave(ready: false)),
),
Expand Down

0 comments on commit dad9e91

Please sign in to comment.