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 'package:timezone/data/latest.dart' as tz;
|
||||
|
||||
import 'theme.dart';
|
||||
|
||||
void main() {
|
||||
runApp(
|
||||
ChangeNotifierProvider(
|
||||
@@ -24,10 +26,7 @@ class MyApp extends StatelessWidget {
|
||||
tz.initializeTimeZones();
|
||||
return MaterialApp(
|
||||
title: 'Floodwatch',
|
||||
theme: ThemeData(
|
||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
|
||||
useMaterial3: true,
|
||||
fontFamily: 'UbuntuSansMono'),
|
||||
theme: defaultTheme,
|
||||
initialRoute: MainNavigationScaffold.routeName,
|
||||
routes: {
|
||||
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(
|
||||
touchTooltipData: LineTouchTooltipData(
|
||||
getTooltipColor: (touchedSpot) =>
|
||||
Theme.of(context).colorScheme.primaryContainer,
|
||||
getTooltipItems: (touchedSpots) {
|
||||
return touchedSpots.map((touchedSpot) {
|
||||
return LineTooltipItem(
|
||||
'${touchedSpot.y.toString()}\n${_getLongDate(touchedSpot.x)}',
|
||||
TextStyle(
|
||||
color: Theme.of(context).colorScheme.onPrimary,
|
||||
color: Theme.of(context).colorScheme.onPrimaryContainer,
|
||||
fontWeight: FontWeight.bold));
|
||||
}).toList();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user