more message view stuff
This commit is contained in:
@@ -11,46 +11,64 @@ class SCNAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
required this.showThemeSwitch,
|
||||
required this.showDebug,
|
||||
required this.showSearch,
|
||||
required this.showShare,
|
||||
this.onShare = null,
|
||||
}) : super(key: key);
|
||||
|
||||
final String? title;
|
||||
final bool showThemeSwitch;
|
||||
final bool showDebug;
|
||||
final bool showSearch;
|
||||
final bool showShare;
|
||||
final void Function()? onShare;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var actions = <Widget>[];
|
||||
|
||||
if (showThemeSwitch) {
|
||||
actions.add(Consumer<AppTheme>(
|
||||
builder: (context, appTheme, child) => IconButton(
|
||||
icon: Icon(appTheme.darkMode ? FontAwesomeIcons.solidSun : FontAwesomeIcons.solidMoon),
|
||||
tooltip: appTheme.darkMode ? 'Light mode' : 'Dark mode',
|
||||
onPressed: appTheme.switchDarkMode,
|
||||
),
|
||||
));
|
||||
} else {
|
||||
actions.add(SizedBox.square(dimension: 40));
|
||||
}
|
||||
|
||||
if (showDebug) {
|
||||
actions.add(IconButton(
|
||||
icon: const Icon(FontAwesomeIcons.solidSpiderBlackWidow),
|
||||
tooltip: 'Debug',
|
||||
onPressed: () {
|
||||
Navigator.push(context, MaterialPageRoute<DebugMainPage>(builder: (context) => DebugMainPage()));
|
||||
},
|
||||
));
|
||||
} else {
|
||||
actions.add(SizedBox.square(dimension: 40));
|
||||
}
|
||||
|
||||
if (showSearch) {
|
||||
actions.add(IconButton(
|
||||
icon: const Icon(FontAwesomeIcons.solidMagnifyingGlass),
|
||||
tooltip: 'Search',
|
||||
onPressed: () {/*TODO*/},
|
||||
));
|
||||
} else if (showShare) {
|
||||
actions.add(IconButton(
|
||||
icon: const Icon(FontAwesomeIcons.solidShareNodes),
|
||||
tooltip: 'Share',
|
||||
onPressed: onShare ?? () {},
|
||||
));
|
||||
} else {
|
||||
actions.add(SizedBox.square(dimension: 40));
|
||||
}
|
||||
|
||||
return AppBar(
|
||||
title: Text(title ?? 'Simple Cloud Notifier 2.0'),
|
||||
actions: <Widget>[
|
||||
if (showThemeSwitch)
|
||||
Consumer<AppTheme>(
|
||||
builder: (context, appTheme, child) => IconButton(
|
||||
icon: Icon(appTheme.darkMode ? FontAwesomeIcons.solidSun : FontAwesomeIcons.solidMoon),
|
||||
tooltip: 'Debug',
|
||||
onPressed: () {
|
||||
appTheme.switchDarkMode();
|
||||
},
|
||||
),
|
||||
),
|
||||
if (!showThemeSwitch) SizedBox.square(dimension: 40),
|
||||
if (showDebug)
|
||||
IconButton(
|
||||
icon: const Icon(FontAwesomeIcons.solidSpiderBlackWidow),
|
||||
tooltip: 'Debug',
|
||||
onPressed: () {
|
||||
Navigator.push(context, MaterialPageRoute<DebugMainPage>(builder: (context) => DebugMainPage()));
|
||||
},
|
||||
),
|
||||
if (!showDebug) SizedBox.square(dimension: 40),
|
||||
if (showSearch)
|
||||
IconButton(
|
||||
icon: const Icon(FontAwesomeIcons.solidMagnifyingGlass),
|
||||
tooltip: 'Search',
|
||||
onPressed: () {},
|
||||
),
|
||||
if (!showSearch) SizedBox.square(dimension: 40),
|
||||
],
|
||||
actions: actions,
|
||||
backgroundColor: Theme.of(context).secondaryHeaderColor,
|
||||
);
|
||||
}
|
||||
|
@@ -9,6 +9,8 @@ class SCNScaffold extends StatelessWidget {
|
||||
this.showThemeSwitch = true,
|
||||
this.showDebug = true,
|
||||
this.showSearch = true,
|
||||
this.showShare = false,
|
||||
this.onShare = null,
|
||||
}) : super(key: key);
|
||||
|
||||
final Widget child;
|
||||
@@ -16,6 +18,8 @@ class SCNScaffold extends StatelessWidget {
|
||||
final bool showThemeSwitch;
|
||||
final bool showDebug;
|
||||
final bool showSearch;
|
||||
final bool showShare;
|
||||
final void Function()? onShare;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -25,6 +29,8 @@ class SCNScaffold extends StatelessWidget {
|
||||
showThemeSwitch: showThemeSwitch,
|
||||
showDebug: showDebug,
|
||||
showSearch: showSearch,
|
||||
showShare: showShare,
|
||||
onShare: onShare ?? () {},
|
||||
),
|
||||
body: child,
|
||||
);
|
||||
|
Reference in New Issue
Block a user