Getting started
C2C Flutter UI Kits is a UI kit built based on C2C's StyleGuide, allowing you to quickly and easily build applications, saving you time. Below is a basic installation guide.
Requirements
Dart SDK>=3.0.0Flutter SDK>=1.17.0
Installation
Install c2c_pub
c2c_pub is a tool to manage the c2c packages. It allows publish, update packages and install c2c packages to project.
Run this command to install c2c_pub:
dart pub global activate c2c_pub -u https://pub.csp.scrum-dev.com
Install c2c_core
c2c_core is a package that contains the core of the c2c packages. When using c2c packages, you may not need to install it, but if you want to easily customize the theme for all widgets, you need to install c2c_core.
With c2c_pub:
cpub add c2c_core
or
With flutter pub:
flutter pub add c2c_core --hosted-url=https://pub.csp.scrum-dev.com
Setup c2c_core
-
Import
c2c_coreand create aC2CThemeDatainstance, C2CThemeData is a class that contains all the theme data of the c2c packages. -
Use
c2cTheme.materialThemeDatato set the default theme forMaterialApp. You can usec2cTheme.materialThemeData.copyWith(...)to customize the material theme. -
Add
C2CCore.init()to the builder of MaterialApp, then you can useC2CTheme.of(context)to get the theme data.
Example:
import 'package:c2c_core/c2c_core.dart';
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.
Widget build(BuildContext context) {
final c2cTheme = C2CThemeData();
return MaterialApp(
title: 'Flutter UIKits Demo',
theme: c2cTheme.materialThemeData,
builder: C2CCore.init(theme: c2cTheme),
home: const MyHomePage(title: 'Flutter UIKits Demo Home Page'),
);
}
}