
Replaces hardcoded colors and standard Theme.of(context) accesses with a custom AppTheme. Introduces distinct light and dark themes and persists the selected theme mode using shared_preferences. Integrates the theme into the main app structure and applies it to various components and pages. Adds google_fonts dependency for theme typography.
12 lines
303 B
Dart
12 lines
303 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
extension StatefulWidgetExtensions on State<StatefulWidget> {
|
|
/// Check if the widget exist before safely setting state.
|
|
void safeSetState(VoidCallback fn) {
|
|
if (mounted) {
|
|
// ignore: invalid_use_of_protected_member
|
|
setState(fn);
|
|
}
|
|
}
|
|
}
|