-
Notifications
You must be signed in to change notification settings - Fork 2
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 #116 from krolmic/chore/graph-header-widget
chore 🔧: add _GraphHeader
- Loading branch information
Showing
2 changed files
with
70 additions
and
59 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,66 @@ | ||
part of '../graph_screen.dart'; | ||
|
||
class _GraphHeader extends StatelessWidget { | ||
const _GraphHeader(); | ||
|
||
Future<void> showSettingsDialog( | ||
BuildContext context, | ||
) { | ||
return showDialog<void>( | ||
context: context, | ||
builder: (dialogContext) { | ||
final translations = AppLocalizations.of(context)!; | ||
|
||
return AppDialog( | ||
title: translations.display, | ||
body: BlocProvider.value( | ||
value: BlocProvider.of<GraphBloc>(context), | ||
child: const _GraphSettings(), | ||
), | ||
confirmButtonText: translations.ok, | ||
onConfirm: () { | ||
Navigator.of(dialogContext).pop(); | ||
}, | ||
buildCancelButton: false, | ||
); | ||
}, | ||
); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return SizedBox( | ||
height: 30, | ||
child: Stack( | ||
children: [ | ||
Positioned.fill( | ||
child: Center( | ||
child: Text( | ||
DateTime.now().year.toString(), | ||
style: Theme.of(context).textTheme.headlineSmall, | ||
), | ||
), | ||
), | ||
Positioned.fill( | ||
child: Align( | ||
alignment: Alignment.centerRight, | ||
child: IconButton( | ||
padding: const EdgeInsets.symmetric( | ||
horizontal: horizontalPaddingSmall, | ||
), | ||
color: AppColors.primarySwatch, | ||
icon: Icon( | ||
Iconsax.setting_4_outline, | ||
size: Theme.of(context).appBarTheme.iconTheme!.size, | ||
), | ||
onPressed: () async { | ||
await showSettingsDialog(context); | ||
}, | ||
), | ||
), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} |