nb_utils 4.2.6
nb_utils: ^4.2.6 copied to clipboard
This package helps you daily usable function with ease. Just add nb_utils with its latest version and that's it you are ready to use.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:nb_utils/nb_utils.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
initialize();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'NB Utils Example',
debugShowCheckedModeBanner: false,
theme: ThemeData(
scaffoldBackgroundColor: scaffoldLightColor,
),
home: HomePage(),
);
}
}
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
double rating = 2.5;
@override
void initState() {
super.initState();
}
Future<void> init() async {
localeLanguageList
.add(LanguageDataModel(flag: '', languageCode: 'en', name: 'English'));
localeLanguageList
.add(LanguageDataModel(flag: '', languageCode: 'ar', name: 'English'));
localeLanguageList
.add(LanguageDataModel(flag: '', languageCode: 'es', name: 'English'));
localeLanguageList
.add(LanguageDataModel(flag: '', languageCode: 'jp', name: 'English'));
/// Widget Method,
/// With custom height and width
/// With custom width
/// With custom height
/// return padding top
/// return padding left
/// return padding right
/// return padding bottom
/// return padding all
/// return custom padding from each side
/// return padding symmetric
/// set visibility
/// add custom corner radius each side
/// add corner radius
/// set widget visibility
/// add opacity to parent widget
/// add rotation to parent widget
/// add scaling to parent widget
/// set parent widget in center
/// add tap to parent widget
/// Launch a new screen
/// Wrap with ShaderMask widget
/// Wrap with ShaderMask widget Gradient
/// add Expanded to parent widget
/// add Flexible to parent widget
/// add FittedBox to parent widget
/// Validate given widget is not null and returns given value if null.
/// Validate given widget is not null and returns given value if null.
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: appBarWidget('Home', showBack: Navigator.canPop(context)),
body: Container(
child: SingleChildScrollView(
child: Column(
children: <Widget>[
LanguageListWidget(
onLanguageChange: (data) {
log(data.name);
},
),
Column(
children: [
RatingBarWidget(
itemCount: 5,
itemColor: Colors.yellow,
initialRating: rating,
onRatingChanged: (e) {
rating = e;
log(e);
setState(() {});
},
),
16.height,
Container(
decoration: boxDecorationDefault(),
height: 100,
width: 100,
),
UL(
symbolType: SymbolType.Numbered,
children: [
Text('Hi', style: primaryTextStyle()),
Text('Hello', style: primaryTextStyle()),
Text('How are you?', style: primaryTextStyle()),
],
),
16.height,
AppTextField(
controller: TextEditingController(),
textFieldType: TextFieldType.EMAIL,
decoration: InputDecoration(
labelText: 'Email', border: OutlineInputBorder()),
),
AppTextField(
controller: TextEditingController(),
textFieldType: TextFieldType.ADDRESS,
decoration: InputDecoration(labelText: 'Address'),
minLines: 4,
),
AppTextField(
controller: TextEditingController(),
textFieldType: TextFieldType.PASSWORD,
decoration: InputDecoration(labelText: 'Password'),
),
],
).paddingAll(16),
16.height,
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
AppButton(
text: 'Save',
onTap: () async {
toastLong('Sample toast');
},
),
16.width,
GoogleLogoWidget(),
],
),
8.height,
SettingSection(
title:
Text('Account Management', style: boldTextStyle(size: 24)),
subTitle: Text('Control your account',
style: primaryTextStyle(size: 16)),
items: [
SettingItemWidget(
title: 'Hibernate account',
subTitle: 'Temporary deactivate your account',
decoration: BoxDecoration(borderRadius: radius()),
trailing: Icon(Icons.keyboard_arrow_right_rounded,
color: context.dividerColor),
onTap: () {
//HomePage().launch(context);
},
),
SettingItemWidget(
title: 'Close account',
subTitle:
'Learn about your options, and close your account if you wish',
decoration: BoxDecoration(borderRadius: radius()),
trailing: Icon(Icons.keyboard_arrow_right_rounded,
color: context.dividerColor),
onTap: () {
//HomePage().launch(context);
},
),
],
),
],
),
),
),
);
}
}