Friday, 6 October 2023

Custom Color in PrimarySwatch (Flutter)

 




import 'package:flutter/material.dart';

void main() {
runApp(
const MyApp(),
);
}

class MyApp extends StatelessWidget {
const MyApp({super.key});

// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Test',
debugShowCheckedModeBanner: false,
theme: ThemeData(
fontFamily: "Inter",
primarySwatch: mycolor,
primaryColor: const Color.fromRGBO(229, 116, 29, 1),
appBarTheme: const AppBarTheme(
backgroundColor: Color.fromRGBO(229, 116, 29, 1),
),
),
home: homeView(),
);
}
}

MaterialColor mycolor = const MaterialColor(
0xFFE5741D,
<int, Color>{
50: Color(0xFFE5741D),
100: Color(0xFFE5741D),
200: Color(0xFFE5741D),
300: Color(0xFFE5741D),
400: Color(0xFFE5741D),
500: Color(0xFFE5741D),
600: Color(0xFFE5741D),
700: Color(0xFFE5741D),
800: Color(0xFFE5741D),
900: Color(0xFFE5741D),
},
);

No comments:

Post a Comment