debug view && priority in listview

This commit is contained in:
2024-05-23 17:41:51 +02:00
parent 34925b6678
commit f5813a5489
12 changed files with 432 additions and 123 deletions

View File

@@ -1,37 +1,55 @@
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
import 'package:simplecloudnotifier/pages/debug/debug_main.dart';
import 'package:simplecloudnotifier/state/app_theme.dart';
class SCNAppBar extends StatelessWidget implements PreferredSizeWidget {
const SCNAppBar({Key? key, this.title}) : super(key: key);
const SCNAppBar({
Key? key,
required this.title,
required this.showThemeSwitch,
required this.showDebug,
required this.showSearch,
}) : super(key: key);
final String? title;
final bool showThemeSwitch;
final bool showDebug;
final bool showSearch;
@override
Widget build(BuildContext context) {
return AppBar(
title: Text(title ?? 'Simple Cloud Notifier 2.0'),
actions: <Widget>[
Consumer<AppTheme>(
builder: (context, appTheme, child) => IconButton(
icon: Icon(appTheme.darkMode ? FontAwesomeIcons.solidSun : FontAwesomeIcons.solidMoon),
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: () {
appTheme.switchDarkMode();
Navigator.push(context, MaterialPageRoute(builder: (context) => DebugMainPage()));
},
),
),
IconButton(
icon: const Icon(FontAwesomeIcons.solidSpiderBlackWidow),
tooltip: 'Debug',
onPressed: () {},
),
IconButton(
icon: const Icon(FontAwesomeIcons.solidMagnifyingGlass),
tooltip: 'Search',
onPressed: () {},
),
if (!showDebug) SizedBox.square(dimension: 40),
if (showSearch)
IconButton(
icon: const Icon(FontAwesomeIcons.solidMagnifyingGlass),
tooltip: 'Search',
onPressed: () {},
),
if (!showSearch) SizedBox.square(dimension: 40),
],
backgroundColor: Theme.of(context).secondaryHeaderColor,
);

View File

@@ -2,16 +2,29 @@ import 'package:flutter/material.dart';
import 'package:simplecloudnotifier/components/layout/app_bar.dart';
class SCNScaffold extends StatelessWidget {
const SCNScaffold({Key? key, required this.child, this.title}) : super(key: key);
const SCNScaffold({
Key? key,
required this.child,
this.title,
this.showThemeSwitch = true,
this.showDebug = true,
this.showSearch = true,
}) : super(key: key);
final Widget child;
final String? title;
final bool showThemeSwitch;
final bool showDebug;
final bool showSearch;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: SCNAppBar(
title: title,
showThemeSwitch: showThemeSwitch,
showDebug: showDebug,
showSearch: showSearch,
),
body: child,
);