added default theme
This commit is contained in:
@@ -7,6 +7,8 @@ import 'pages/main_navigation_scaffold.dart';
|
|||||||
import 'services/flood_station_provider.dart';
|
import 'services/flood_station_provider.dart';
|
||||||
import 'package:timezone/data/latest.dart' as tz;
|
import 'package:timezone/data/latest.dart' as tz;
|
||||||
|
|
||||||
|
import 'theme.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
runApp(
|
runApp(
|
||||||
ChangeNotifierProvider(
|
ChangeNotifierProvider(
|
||||||
@@ -24,10 +26,7 @@ class MyApp extends StatelessWidget {
|
|||||||
tz.initializeTimeZones();
|
tz.initializeTimeZones();
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
title: 'Floodwatch',
|
title: 'Floodwatch',
|
||||||
theme: ThemeData(
|
theme: defaultTheme,
|
||||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
|
|
||||||
useMaterial3: true,
|
|
||||||
fontFamily: 'UbuntuSansMono'),
|
|
||||||
initialRoute: MainNavigationScaffold.routeName,
|
initialRoute: MainNavigationScaffold.routeName,
|
||||||
routes: {
|
routes: {
|
||||||
MainNavigationScaffold.routeName: (context) => MainNavigationScaffold(),
|
MainNavigationScaffold.routeName: (context) => MainNavigationScaffold(),
|
||||||
|
|||||||
35
lib/theme.dart
Normal file
35
lib/theme.dart
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
ThemeData get defaultTheme {
|
||||||
|
return ThemeData(
|
||||||
|
fontFamily: 'UbuntuSansMono',
|
||||||
|
colorScheme: ColorScheme.fromSeed(
|
||||||
|
seedColor: Colors.amber,
|
||||||
|
brightness: Brightness.light,
|
||||||
|
),
|
||||||
|
textTheme: _defaultTextTheme,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
ThemeData get defaultDarkTheme {
|
||||||
|
return ThemeData(
|
||||||
|
fontFamily: 'UbuntuSansMono',
|
||||||
|
colorScheme: ColorScheme.fromSeed(
|
||||||
|
seedColor: Colors.lightGreen,
|
||||||
|
brightness: Brightness.dark,
|
||||||
|
),
|
||||||
|
textTheme: _defaultTextTheme,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
TextTheme get _defaultTextTheme => TextTheme(
|
||||||
|
titleLarge: TextStyle(
|
||||||
|
fontWeight: FontWeight.w800,
|
||||||
|
),
|
||||||
|
titleMedium: TextStyle(
|
||||||
|
fontWeight: FontWeight.w800,
|
||||||
|
),
|
||||||
|
titleSmall: TextStyle(
|
||||||
|
fontWeight: FontWeight.w800,
|
||||||
|
),
|
||||||
|
);
|
||||||
@@ -48,12 +48,14 @@ class ReadingGraph extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
lineTouchData: LineTouchData(
|
lineTouchData: LineTouchData(
|
||||||
touchTooltipData: LineTouchTooltipData(
|
touchTooltipData: LineTouchTooltipData(
|
||||||
|
getTooltipColor: (touchedSpot) =>
|
||||||
|
Theme.of(context).colorScheme.primaryContainer,
|
||||||
getTooltipItems: (touchedSpots) {
|
getTooltipItems: (touchedSpots) {
|
||||||
return touchedSpots.map((touchedSpot) {
|
return touchedSpots.map((touchedSpot) {
|
||||||
return LineTooltipItem(
|
return LineTooltipItem(
|
||||||
'${touchedSpot.y.toString()}\n${_getLongDate(touchedSpot.x)}',
|
'${touchedSpot.y.toString()}\n${_getLongDate(touchedSpot.x)}',
|
||||||
TextStyle(
|
TextStyle(
|
||||||
color: Theme.of(context).colorScheme.onPrimary,
|
color: Theme.of(context).colorScheme.onPrimaryContainer,
|
||||||
fontWeight: FontWeight.bold));
|
fontWeight: FontWeight.bold));
|
||||||
}).toList();
|
}).toList();
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user