custom_styles_package 1.0.5
custom_styles_package: ^1.0.5 copied to clipboard
A Custom Styles Flutter package with customizable widgets like CustomText, CustomButton & CustomTextField with global theming and flexible styling support.
example/lib/main.dart
import 'package:custom_styles_package/custom_styles_package.dart';
import 'package:custom_styles_package/theme/custom_decorations.dart';
import 'package:custom_styles_package/theme/custom_text_styles.dart';
import 'package:flutter/material.dart';
void main() {
CustomStylesConfig.init(
primary: Colors.black,
isDarkMode: true,
fontSize: 14,
initializeCustomDecoration: false,
initializeCustomTextSyle: false,
);
CustomTextStyle.init(headingLargeStyle: TextStyle(fontSize: 70));
CustomDecorations.init(
textfieldInputDecoration: InputDecoration(
// contentPadding: EdgeInsets.symmetric(horizontal: 16),
),
);
// CustomStylesConfig.init(primary: Colors.black,isDarkMode: true,fontSize: 14 );
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 CustomScreenUtil(
designSize: const Size(390, 850),
child: MaterialApp(
title: 'Custom Styling Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
),
home: const MyHomePage(title: 'App bar title'),
),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
void initState() {
// TODO: implement initState
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
// backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: CustomText.appbarText(
widget.title,
), // use this widget to show app bar title
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
CustomText.heading(
'Heading Text',
), // use this widget to show headings
CustomText.bodyText1(
'Body Text 1',
), // use this widget to body text 1
CustomText.bodyText2(
'Body Text 2',
), // use this widget to body text 2
CustomTextField(
controller: TextEditingController(),
hintText: 'Type something here',
prefix: Icon(Icons.abc),
),
CustomRichText(
firstText: 'Hello this is first text',
secondText: 'This is second text',
),
CustomButton(
text: 'Submit',
// isSolid: false,
showGradient: true,
// customGradient: LinearGradient(colors: [Colors.black12, Colors.white, Colors.black]),
onTap: () {
customPrint('Submit button pressed');
},
borderRadius: 12,
color: Colors.green,
// textColor: Colors.yellow,
), // use this to show button
],
),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}