I have created a custom theme in flutter app. It working fine in android but have only violate color in ios. I tried but nothing is changed.
main.dart
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:get_storage/get_storage.dart';
import 'package:newflutter/ui_helper/theme_const.dart';
import 'package:newflutter/views/decider.dart';
import 'package:flutter/services.dart';
import 'package:upgrader/upgrader.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
// await Upgrader.clearSavedSettings();
await Firebase.initializeApp();
FirebaseMessaging messaging = FirebaseMessaging.instance;
print('User granted permission: ${settings.authorizationStatus}');
await GetStorage.init();
final localMemory = GetStorage();
bool? isDarkTheme = localMemory.read('isDark');
localMemory.write('isFirstTimeHome', true);
runApp(MyApp(
isDarkTheme: isDarkTheme,
));
}
class MyApp extends StatelessWidget {
final bool? isDarkTheme;
const MyApp({super.key, this.isDarkTheme});
get camera => null;
@override
Widget build(BuildContext context) {
isDarkTheme == null || isDarkTheme == true
? SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
statusBarIconBrightness: Brightness.light,
systemNavigationBarColor: Colors.black,
systemNavigationBarDividerColor: Colors.black,
systemNavigationBarIconBrightness: Brightness.dark,
))
: null;
return GetMaterialApp(
title: 'Test',
debugShowCheckedModeBanner: false,
themeMode: isDarkTheme == null || isDarkTheme == true
? ThemeMode.light
: ThemeMode.dark,
theme: lightTheme,
darkTheme: darkTheme,
home: UpgradeAlert(upgrader: Upgrader(), child: const Decider()),
);
}
}
theme file
import 'package:flutter/material.dart';
// Define your custom primary color
MaterialColor customPrimaryColor = const MaterialColor(
0xFF10489B,
<int, Color>{
50: Color(0xFFss10489B),
100: Color(0xFF10489B),
800: Color(0xFFss10489B),
900: Color(0xFF10ss489B),
},
);
ThemeData lightTheme = ThemeData(
primarySwatch: customPrimaryColor,
primaryColorDark: Colors.indigoAccent,
primaryColorLight: const Color(0xffC3D8FB),
fontFamily: 'Mulish',
brightness: Brightness.light,
textTheme: const TextTheme(
displayLarge: TextStyle(
fontWeight: FontWeight.w600,
fontFamily: 'Mulish-Bold',
fontSize: 22,
color: Color(0xff000000),
),
headlineSmall: TextStyle(
fontWeight: FontWeight.w700,
fontFamily: 'Mulish-Bold',
fontSize: 16,
color: Color(0xff000000),
),
),
);
ThemeData darkTheme = ThemeData(
brightness: Brightness.dark,
//primarySwatch: Colors.red,
primaryColorDark: const Color.fromARGB(255, 39, 39, 39),
primaryColorLight: const Color(0xff444444),
cardTheme: const CardTheme(elevation: 0),
fontFamily: 'Mulish',
textTheme: const TextTheme(
displayLarge: TextStyle(
fontWeight: FontWeight.w600,
fontFamily: 'Mulish-Bold',
fontSize: 22,
color: Color(0xffffffff),
),
headlineSmall: TextStyle(
fontWeight: FontWeight.w700,
fontFamily: 'Mulish-Bold',
fontSize: 16,
color: Color(0xffffffff),
),
),
);
Please check this one and let me know if anyone find issue. Thankx in advance. please see this once. I have added theme file and main.dart file also




