| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- import 'package:flutter/material.dart';
- import 'package:flutter_riverpod/flutter_riverpod.dart';
- final appThemeProvider = StateProvider<bool>((ref) => true);
- ThemeData myTheme(BuildContext context, bool isDarkTheme) {
- if (isDarkTheme) {
- return ThemeData.dark();
- } else {
- return ThemeData.light();
- }
- }
- // import 'package:flutter/material.dart';
- // import 'package:flutter_riverpod/flutter_riverpod.dart';
- // AppColors colors(context) => Theme.of(context).extension<AppColors>()!;
- // final appThemeProvider = StateProvider<bool>((ref) => true);
- // ThemeData getAppTheme(BuildContext context, bool isDarkTheme) {
- // //return isDarkTheme ? ThemeData.dark() : ThemeData.light();
- // return (isDarkTheme ? ThemeData.dark() : ThemeData.light()).copyWith(
- // extensions: <ThemeExtension<AppColors>>[
- // AppColors(
- // color1: isDarkTheme ? Colors.blue : Colors.green,
- // color2: isDarkTheme ? Colors.pink : Colors.blue,
- // color3: isDarkTheme ? Colors.yellow : Colors.red,
- // ),
- // ],
- // scaffoldBackgroundColor: isDarkTheme ? Colors.black : Colors.white,
- // textTheme: Theme.of(context)
- // .textTheme
- // .copyWith(
- // titleSmall:
- // Theme.of(context).textTheme.titleSmall?.copyWith(fontSize: 12),
- // )
- // .apply(
- // bodyColor: isDarkTheme ? Colors.white : Colors.black,
- // displayColor: Colors.grey,
- // ),
- // switchTheme: SwitchThemeData(
- // thumbColor: MaterialStateProperty.all(
- // isDarkTheme ? Colors.orange : Colors.purple),
- // ),
- // listTileTheme: ListTileThemeData(
- // iconColor: isDarkTheme ? Colors.orange : Colors.purple),
- // appBarTheme: AppBarTheme(
- // //backgroundColor: isDarkTheme ? Colors.black : Colors.white,
- // iconTheme:
- // IconThemeData(color: isDarkTheme ? Colors.white : Colors.black54)),
- // );
- // }
- // @immutable
- // class AppColors extends ThemeExtension<AppColors> {
- // final Color? color1;
- // final Color? color2;
- // final Color? color3;
- // const AppColors({
- // required this.color1,
- // required this.color2,
- // required this.color3,
- // });
- // @override
- // AppColors copyWith({
- // Color? color1,
- // Color? color2,
- // Color? color3,
- // }) {
- // return AppColors(
- // color1: color1 ?? this.color1,
- // color2: color2 ?? this.color2,
- // color3: color3 ?? this.color3,
- // );
- // }
- // @override
- // AppColors lerp(ThemeExtension<AppColors>? other, double t) {
- // if (other is! AppColors) {
- // return this;
- // }
- // return AppColors(
- // color1: Color.lerp(color1, other.color1, t),
- // color2: Color.lerp(color2, other.color2, t),
- // color3: Color.lerp(color3, other.color3, t),
- // );
- // }
- // }
|