Skip to content

Commit

Permalink
Merge pull request #8 from meg4cyberc4t/improvements
Browse files Browse the repository at this point in the history
Removing ThemeResolver, theme is now initialized only in ThemeStateMixin
  • Loading branch information
meg4cyberc4t authored Sep 9, 2024
2 parents 49c0d76 + a303308 commit 4329dd1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 41 deletions.
28 changes: 0 additions & 28 deletions lib/src/common/theme/theme_resolver.dart

This file was deleted.

25 changes: 12 additions & 13 deletions lib/src/common/theme/theme_state_mixin.dart
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
import 'package:flutter/material.dart';
import 'package:web_template/src/common/theme/theme_resolver.dart';

/// The mixing ThemeStateMixin provides the functionality for
/// managing themes.
mixin ThemeStateMixin<T extends StatefulWidget> on State<T> {
/// The main class of the navigaiton package.
late final ThemeResolver _themeResolver;

@override
void initState() {
_themeResolver = ThemeResolver();
super.initState();
}
/// The dark theme of the application
final ThemeData darkTheme = ThemeData.from(
colorScheme: ColorScheme.fromSwatch(
primarySwatch: Colors.lightGreen,
brightness: Brightness.dark,
),
);

/// The light theme of the application
ThemeData get lightTheme => _themeResolver.light;

/// The dark theme of the application
ThemeData get darkTheme => _themeResolver.dark;
final ThemeData lightTheme = ThemeData.from(
colorScheme: ColorScheme.fromSwatch(
primarySwatch: Colors.green,
),
);
}

0 comments on commit 4329dd1

Please sign in to comment.