C2CCore
Overview
C2CCore is a widget that provides the theme for the entire application. It is usually used as the root widget of the application.
Configure the theme for the entire application
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
Widget build(BuildContext context) {
// Add custom theme data
final c2cTheme = C2CThemeData(
textTheme: const C2CTextThemeData(fontFamily: 'NotoSansJP'),
colors: const C2CColorThemeData(
primary1: Color.fromRGBO(234, 247, 255, 1),
primary2: Color.fromRGBO(47, 121, 234, 1),
primary3: Color.fromRGBO(0, 80, 201, 1),
primary4: Color.fromRGBO(10, 66, 149, 1),
),
// ... other theme data
);
return MaterialApp(
title: 'Flutter UIKits Demo',
theme: c2cTheme.materialThemeData,
builder: C2CCore.init(theme: c2cTheme),
home: const MyHomePage(title: 'Flutter UIKits Demo Home Page'),
);
}
}
Use theme
Widget build(BuildContext context) {
final c2cTheme = C2CTheme.of(context);
return Container(color: c2cTheme.colors.primary3);
}
C2CThemeData Properties
| Property | Type | Description |
|---|---|---|
textTheme | C2CTextThemeData | The text theme for C2C UIKits. |
colors | C2CColorThemeData | The color theme for C2C UIKits. |
inputTheme | C2CInputThemeData | The theme for the input widgets. |
primaryButtonTheme | C2CPrimaryButtonThemeData | The theme for the primary button. |
secondaryButtonTheme | C2CSecondaryButtonThemeData | The theme for the secondary button. |
imageTheme | C2CImageThemeData | The theme for the image widgets. |
bottomTabsTheme | C2CBottomTabsThemeData | The theme for the bottom tabs. |
checkboxTheme | C2CCheckboxThemeData | The theme for the checkbox widgets. |
radioTheme | C2CRadioThemeData | The theme for the radio widgets. |
switchTheme | C2CSwitchThemeData | The theme for the switch widgets. |
selectTheme | C2CSelectThemeData | The theme for the select widgets. |
toastTheme | C2CToastThemeData | The theme for the toast widgets. |
dialogTheme | C2CDialogThemeData | The theme for the dialog widgets. |
stepperTheme | C2CStepperThemeData | The theme for the stepper widgets. |
datePickerTheme | C2CDatePickerThemeData | The theme for the date picker widgets. |