minor changes to theme & dialogs

This commit is contained in:
Thibault Deckers 2020-11-22 21:39:09 +09:00
parent d989b6010f
commit 6fed7b0939
15 changed files with 73 additions and 50 deletions

View file

@ -57,6 +57,7 @@ class _AvesAppState extends State<AvesApp> {
accentColor: accentColor, accentColor: accentColor,
scaffoldBackgroundColor: Colors.grey[900], scaffoldBackgroundColor: Colors.grey[900],
buttonColor: accentColor, buttonColor: accentColor,
dialogBackgroundColor: Colors.grey[850],
toggleableActiveColor: accentColor, toggleableActiveColor: accentColor,
tooltipTheme: TooltipThemeData( tooltipTheme: TooltipThemeData(
verticalOffset: 32, verticalOffset: 32,

View file

@ -64,8 +64,19 @@ class _LicensesState extends State<Licenses> {
), ),
Center( Center(
child: TextButton( child: TextButton(
onPressed: () => showLicensePage(context: context), onPressed: () => Navigator.push(
child: Text('All Licenses'.toUpperCase()), context,
MaterialPageRoute(
builder: (context) => Theme(
data: Theme.of(context).copyWith(
// as of Flutter v1.22.4, `cardColor` is used as a background color by `LicensePage`
cardColor: Theme.of(context).scaffoldBackgroundColor,
),
child: LicensePage(),
),
),
),
child: Text('Show All Licenses'.toUpperCase()),
), ),
), ),
], ],

View file

@ -37,6 +37,7 @@ class _AddShortcutDialogState extends State<AddShortcutDialog> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AvesDialog( return AvesDialog(
context: context,
content: TextField( content: TextField(
controller: _nameController, controller: _nameController,
decoration: InputDecoration( decoration: InputDecoration(

View file

@ -41,6 +41,7 @@ class _CreateAlbumDialogState extends State<CreateAlbumDialog> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AvesDialog( return AvesDialog(
context: context,
title: 'New Album', title: 'New Album',
scrollController: _scrollController, scrollController: _scrollController,
scrollableContent: [ scrollableContent: [

View file

@ -152,6 +152,7 @@ class EntryActionDelegate with FeedbackMixin, PermissionAwareMixin {
context: context, context: context,
builder: (context) { builder: (context) {
return AvesDialog( return AvesDialog(
context: context,
content: Text('Are you sure?'), content: Text('Are you sure?'),
actions: [ actions: [
TextButton( TextButton(

View file

@ -25,6 +25,7 @@ mixin PermissionAwareMixin {
context: context, context: context,
builder: (context) { builder: (context) {
return AvesDialog( return AvesDialog(
context: context,
title: 'Storage Volume Access', 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.'), 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: [ actions: [

View file

@ -39,6 +39,7 @@ class _RenameAlbumDialogState extends State<RenameAlbumDialog> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AvesDialog( return AvesDialog(
context: context,
content: ValueListenableBuilder<bool>( content: ValueListenableBuilder<bool>(
valueListenable: _existsNotifier, valueListenable: _existsNotifier,
builder: (context, exists, child) { builder: (context, exists, child) {

View file

@ -37,6 +37,7 @@ class _RenameEntryDialogState extends State<RenameEntryDialog> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AvesDialog( return AvesDialog(
context: context,
content: TextField( content: TextField(
controller: _nameController, controller: _nameController,
decoration: InputDecoration( decoration: InputDecoration(

View file

@ -146,6 +146,7 @@ class SelectionActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAwar
context: context, context: context,
builder: (context) { builder: (context) {
return AvesDialog( return AvesDialog(
context: context,
content: Text('Are you sure you want to delete ${Intl.plural(count, one: 'this item', other: 'these $count items')}?'), content: Text('Are you sure you want to delete ${Intl.plural(count, one: 'this item', other: 'these $count items')}?'),
actions: [ actions: [
TextButton( TextButton(

View file

@ -34,6 +34,7 @@ mixin SizeAwareMixin {
context: context, context: context,
builder: (context) { builder: (context) {
return AvesDialog( return AvesDialog(
context: context,
title: 'Not Enough Space', title: 'Not Enough Space',
content: Text('This operation needs ${formatFilesize(needed)} of free space on “${destinationVolume.description}” to complete, but there is only ${formatFilesize(free)} left.'), content: Text('This operation needs ${formatFilesize(needed)} of free space on “${destinationVolume.description}” to complete, but there is only ${formatFilesize(free)} left.'),
actions: [ actions: [

View file

@ -3,8 +3,10 @@ import 'package:flutter/widgets.dart';
class AvesDialog extends AlertDialog { class AvesDialog extends AlertDialog {
static const contentHorizontalPadding = EdgeInsets.symmetric(horizontal: 24); static const contentHorizontalPadding = EdgeInsets.symmetric(horizontal: 24);
static const borderWidth = 1.0;
AvesDialog({ AvesDialog({
@required BuildContext context,
String title, String title,
ScrollController scrollController, ScrollController scrollController,
List<Widget> scrollableContent, List<Widget> scrollableContent,
@ -12,31 +14,35 @@ class AvesDialog extends AlertDialog {
@required List<Widget> actions, @required List<Widget> actions,
}) : assert((scrollableContent != null) ^ (content != null)), }) : assert((scrollableContent != null) ^ (content != null)),
super( super(
title: title != null ? DialogTitle(title: title) : null, title: title != null ? Padding(
// padding to avoid transparent border overlapping
padding: EdgeInsets.symmetric(horizontal: borderWidth),
child: DialogTitle(title: title),
) : null,
titlePadding: EdgeInsets.zero, titlePadding: EdgeInsets.zero,
// the `scrollable` flag of `AlertDialog` makes it // the `scrollable` flag of `AlertDialog` makes it
// scroll both the title and the content together, // scroll both the title and the content together,
// and overflow feedback ignores the dialog shape, // and overflow feedback ignores the dialog shape,
// so we restrict scrolling to the content instead // so we restrict scrolling to the content instead
content: scrollableContent != null content: scrollableContent != null
? Builder( ? Container(
builder: (context) => Container( // padding to avoid transparent border overlapping
// workaround because the dialog tries padding: EdgeInsets.symmetric(horizontal: borderWidth),
// to size itself to the content intrinsic size, // workaround because the dialog tries
// but the `ListView` viewport does not have one // to size itself to the content intrinsic size,
width: 1, // but the `ListView` viewport does not have one
child: DecoratedBox( width: 1,
decoration: BoxDecoration( child: DecoratedBox(
border: Border( decoration: BoxDecoration(
bottom: Divider.createBorderSide(context, width: 1), border: Border(
), bottom: Divider.createBorderSide(context, width: borderWidth),
),
child: ListView(
controller: scrollController ?? ScrollController(),
shrinkWrap: true,
children: scrollableContent,
), ),
), ),
child: ListView(
controller: scrollController ?? ScrollController(),
shrinkWrap: true,
children: scrollableContent,
),
), ),
) )
: content, : content,
@ -44,6 +50,7 @@ class AvesDialog extends AlertDialog {
actions: actions, actions: actions,
actionsPadding: EdgeInsets.symmetric(horizontal: 8), actionsPadding: EdgeInsets.symmetric(horizontal: 8),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
side: Divider.createBorderSide(context, width: borderWidth),
borderRadius: BorderRadius.circular(24), borderRadius: BorderRadius.circular(24),
), ),
); );
@ -61,7 +68,7 @@ class DialogTitle extends StatelessWidget {
padding: const EdgeInsets.symmetric(vertical: 20), padding: const EdgeInsets.symmetric(vertical: 20),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border( border: Border(
bottom: Divider.createBorderSide(context, width: 1), bottom: Divider.createBorderSide(context, width: AvesDialog.borderWidth),
), ),
), ),
child: Text( child: Text(
@ -80,6 +87,7 @@ void showNoMatchingAppDialog(BuildContext context) {
context: context, context: context,
builder: (context) { builder: (context) {
return AvesDialog( return AvesDialog(
context: context,
title: 'No Matching App', title: 'No Matching App',
content: Text('There are no apps that can handle this.'), content: Text('There are no apps that can handle this.'),
actions: [ actions: [

View file

@ -35,6 +35,7 @@ class _AvesSelectionDialogState<T> extends State<AvesSelectionDialog> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AvesDialog( return AvesDialog(
context: context,
title: widget.title, title: widget.title,
scrollableContent: widget.options.entries.map((kv) => _buildRadioListTile(kv.key, kv.value)).toList(), scrollableContent: widget.options.entries.map((kv) => _buildRadioListTile(kv.key, kv.value)).toList(),
actions: [ actions: [

View file

@ -38,37 +38,30 @@ class _AppDrawerState extends State<AppDrawer> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final header = Container( final header = Container(
decoration: BoxDecoration( padding: EdgeInsets.all(16),
border: Border( color: Theme.of(context).accentColor,
bottom: Divider.createBorderSide(context), child: SafeArea(
), child: Column(
), crossAxisAlignment: CrossAxisAlignment.start,
child: Container( children: [
padding: EdgeInsets.all(16), Align(
color: Theme.of(context).accentColor, alignment: AlignmentDirectional.centerStart,
child: SafeArea( child: Wrap(
child: Column( spacing: 16,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: WrapCrossAlignment.center,
children: [ children: [
Align( AvesLogo(size: 64),
alignment: AlignmentDirectional.centerStart, Text(
child: Wrap( 'Aves',
spacing: 16, style: TextStyle(
crossAxisAlignment: WrapCrossAlignment.center, fontSize: 44,
children: [ fontFamily: 'Concourse Caps',
AvesLogo(size: 64),
Text(
'Aves',
style: TextStyle(
fontSize: 44,
fontFamily: 'Concourse Caps',
),
), ),
], ),
), ],
), ),
], ),
), ],
), ),
), ),
); );

View file

@ -58,6 +58,7 @@ class AlbumChipActionDelegate extends ChipActionDelegate with FeedbackMixin, Per
context: context, context: context,
builder: (context) { builder: (context) {
return AvesDialog( return AvesDialog(
context: context,
content: Text('Are you sure you want to delete this album and its ${Intl.plural(count, one: 'item', other: '$count items')}?'), content: Text('Are you sure you want to delete this album and its ${Intl.plural(count, one: 'item', other: '$count items')}?'),
actions: [ actions: [
TextButton( TextButton(

View file

@ -43,7 +43,7 @@ class InfoPageState extends State<InfoPage> {
key: Key('back-button'), key: Key('back-button'),
icon: Icon(AIcons.goUp), icon: Icon(AIcons.goUp),
onPressed: _goToImage, onPressed: _goToImage,
tooltip: 'Back to media', tooltip: 'Back to viewer',
), ),
title: Text('Info'), title: Text('Info'),
floating: true, floating: true,