Skip to content

Commit

Permalink
upd theme
Browse files Browse the repository at this point in the history
don't use material3
  • Loading branch information
X-Wei committed Apr 21, 2024
1 parent 4513c36 commit fe91059
Showing 1 changed file with 19 additions and 31 deletions.
50 changes: 19 additions & 31 deletions lib/themes.dart
Original file line number Diff line number Diff line change
@@ -1,68 +1,56 @@
// ignore_for_file: deprecated_member_use

import 'package:flutter/material.dart';

// This file is adapted from
// https://github.com/flutter/flutter/blob/master/examples/flutter_gallery/lib/gallery/themes.dart

final kLightTheme = _buildLightTheme();
final kDarkTheme = _buildDarkTheme();
const _primaryColor = Color(0xFF0175c2);
const _secondaryColor = Color(0xFF13B9FD);

ThemeData _buildLightTheme() {
const Color primaryColor = Color(0xFF0175c2);
const Color secondaryColor = Color(0xFF13B9FD);
final ColorScheme colorScheme = const ColorScheme.light().copyWith(
primary: primaryColor,
secondary: secondaryColor,
final colorScheme = const ColorScheme.light().copyWith(
primary: _primaryColor,
secondary: _secondaryColor,
background: Colors.white,
error: const Color(0xFFB00020),
);
final ThemeData base = ThemeData(
return ThemeData(
useMaterial3: false,
brightness: Brightness.light,
colorScheme: colorScheme,
primaryColor: primaryColor,
primaryColor: _primaryColor,
indicatorColor: Colors.white,
toggleableActiveColor: const Color(0xFF1E88E5),
splashColor: Colors.white24,
splashFactory: InkRipple.splashFactory,
canvasColor: Colors.white,
scaffoldBackgroundColor: Colors.white,
backgroundColor: Colors.white,
errorColor: const Color(0xFFB00020),
buttonTheme: ButtonThemeData(
colorScheme: colorScheme,
textTheme: ButtonTextTheme.primary,
),
);
return base.copyWith(
textTheme: base.textTheme,
primaryTextTheme: base.primaryTextTheme,
);
}

ThemeData _buildDarkTheme() {
const Color primaryColor = Color(0xFF0175c2);
const Color secondaryColor = Color(0xFF13B9FD);
final ColorScheme colorScheme = const ColorScheme.dark().copyWith(
primary: primaryColor,
secondary: secondaryColor,
final colorScheme = const ColorScheme.dark().copyWith(
primary: _primaryColor,
secondary: _secondaryColor,
background: const Color(0xFF202124),
error: const Color(0xFFB00020),
);
final ThemeData base = ThemeData(
return ThemeData(
useMaterial3: false,
brightness: Brightness.dark,
primaryColor: primaryColor,
primaryColor: _primaryColor,
primaryColorDark: const Color(0xFF0050a0),
primaryColorLight: secondaryColor,
primaryColorLight: _secondaryColor,
indicatorColor: Colors.white,
toggleableActiveColor: const Color(0xFF6997DF),
canvasColor: const Color(0xFF202124),
scaffoldBackgroundColor: const Color(0xFF202124),
backgroundColor: const Color(0xFF202124),
errorColor: const Color(0xFFB00020),
buttonTheme: ButtonThemeData(
colorScheme: colorScheme,
textTheme: ButtonTextTheme.primary,
),
);
return base.copyWith(
textTheme: base.textTheme,
primaryTextTheme: base.primaryTextTheme,
);
}

0 comments on commit fe91059

Please sign in to comment.