Skip to content

Commit

Permalink
Fix AppBar Color (fix #15)
Browse files Browse the repository at this point in the history
  • Loading branch information
ponkotuy committed Aug 24, 2022
1 parent 9d315fb commit d7320b8
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/my_app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ class MyAppBar extends StatelessWidget implements PreferredSizeWidget {
return target != null;
}

Color primary(BuildContext context) {
return Theme.of(context).colorScheme.inversePrimary;
}

@override
Widget build(BuildContext context) {
return AppBar(
Expand All @@ -55,21 +59,25 @@ class MyAppBar extends StatelessWidget implements PreferredSizeWidget {
onPressed: runPickFile,
icon: const Icon(Icons.file_open),
text: const Text('Open'),
color: primary(context),
),
IconTextButton(
onPressed: shareable() ? runShare : null,
icon: const Icon(Icons.share),
text: const Text('Share'),
color: primary(context),
),
IconTextButton(
onPressed: isOpenImage() ? copyDesktop : null,
icon: const Icon(Icons.content_copy),
text: const Text('Copy desktop'),
color: primary(context),
),
IconTextButton(
onPressed: isOpenImage() ? deleteFile : null,
icon: const Icon(Icons.delete),
text: const Text('Delete')
text: const Text('Delete'),
color: primary(context),
),
]
);
Expand All @@ -80,15 +88,17 @@ class MyAppBar extends StatelessWidget implements PreferredSizeWidget {
}

class IconTextButton extends StatelessWidget {
const IconTextButton({Key? key, required this.onPressed, required this.icon, required this.text}) : super(key: key);
const IconTextButton({Key? key, required this.onPressed, required this.icon, required this.text, required this.color}) : super(key: key);

final VoidCallback? onPressed;
final Icon icon;
final Text text;
final Color color;

@override
Widget build(BuildContext context) {
return TextButton(
style: TextButton.styleFrom(primary: color),
onPressed: onPressed,
child: Row(
mainAxisSize: MainAxisSize.min,
Expand Down

0 comments on commit d7320b8

Please sign in to comment.