Added darkmode for chat view
This commit is contained in:
128
lib/screen/pages/more/debug/ThemeColors.dart
Normal file
128
lib/screen/pages/more/debug/ThemeColors.dart
Normal file
@ -0,0 +1,128 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ColorPreviewWidget extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final themeData = Theme.of(context);
|
||||
|
||||
return ListView(
|
||||
children: <Widget>[
|
||||
ListTile(
|
||||
leading: Icon(Icons.color_lens_outlined),
|
||||
title: Text('Farbtest'),
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => ColorPreviewPage(),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ColorPreviewPage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final themeData = Theme.of(context);
|
||||
final colorScheme = themeData.colorScheme;
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Farbtest'),
|
||||
),
|
||||
body: ListView(
|
||||
children: <Widget>[
|
||||
for (var entry in [
|
||||
'Primary',
|
||||
'Primary Variant',
|
||||
'Secondary',
|
||||
'Secondary Variant',
|
||||
'Background',
|
||||
'Surface',
|
||||
'Error',
|
||||
'On Primary',
|
||||
'On Secondary',
|
||||
'On Background',
|
||||
'On Surface',
|
||||
'On Error',
|
||||
])
|
||||
ColorItem(name: entry, color: _getColor(colorScheme, entry)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Color _getColor(ColorScheme colorScheme, String name) {
|
||||
switch (name) {
|
||||
case 'Primary':
|
||||
return colorScheme.primary;
|
||||
case 'Primary Variant':
|
||||
return colorScheme.primaryVariant;
|
||||
case 'Secondary':
|
||||
return colorScheme.secondary;
|
||||
case 'Secondary Variant':
|
||||
return colorScheme.secondaryVariant;
|
||||
case 'Background':
|
||||
return colorScheme.background;
|
||||
case 'Surface':
|
||||
return colorScheme.surface;
|
||||
case 'Error':
|
||||
return colorScheme.error;
|
||||
case 'On Primary':
|
||||
return colorScheme.onPrimary;
|
||||
case 'On Secondary':
|
||||
return colorScheme.onSecondary;
|
||||
case 'On Background':
|
||||
return colorScheme.onBackground;
|
||||
case 'On Surface':
|
||||
return colorScheme.onSurface;
|
||||
case 'On Error':
|
||||
return colorScheme.onError;
|
||||
default:
|
||||
return Colors.transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ColorItem extends StatelessWidget {
|
||||
final String name;
|
||||
final Color color;
|
||||
|
||||
const ColorItem({Key? key, required this.name, required this.color})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final themeData = Theme.of(context);
|
||||
|
||||
return Container(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
color: color,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
name,
|
||||
style: TextStyle(
|
||||
color: themeData.brightness == Brightness.light
|
||||
? Colors.black
|
||||
: Colors.white,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'#${color.value.toRadixString(16).padLeft(8, '0').toUpperCase()}',
|
||||
style: TextStyle(
|
||||
color: themeData.brightness == Brightness.light
|
||||
? Colors.black
|
||||
: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ import 'package:marianum_mobile/screen/settings/settings.dart';
|
||||
import 'package:persistent_bottom_nav_bar/persistent_tab_view.dart';
|
||||
|
||||
import '../../../widget/ListItem.dart';
|
||||
import 'debug/ThemeColors.dart';
|
||||
import 'message/message.dart';
|
||||
|
||||
class Overhang extends StatelessWidget {
|
||||
@ -20,11 +21,12 @@ class Overhang extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
body: ListView(
|
||||
children: const [
|
||||
children: [
|
||||
ListItemNavigator(icon: Icons.newspaper, text: "Marianum Message", target: Message()),
|
||||
ListItemNavigator(icon: Icons.room, text: "Raumplan", target: Roomplan()),
|
||||
ListItemNavigator(icon: Icons.calendar_month, text: "Schulferien", target: Roomplan()),
|
||||
ListItemNavigator(icon: Icons.calculate, text: "Notendurschnitts rechner", target: Roomplan())
|
||||
ListItemNavigator(icon: Icons.calculate, text: "Notendurschnitts rechner", target: Roomplan()),
|
||||
ListItemNavigator(icon: Icons.color_lens_outlined, text: "Farbtest", target: ColorPreviewPage())
|
||||
],
|
||||
),
|
||||
);
|
||||
|
Reference in New Issue
Block a user