Generated by the Very Good CLI 🤖
A BASF Flutter components library for Flutter
Add BASF Flutter Components to your pubspec.yaml file:
dependencies:
basf_flutter_components:
Import the library into your .dart
file:
import 'package:basf_flutter_components/basf_flutter_components.dart';
Use your IDE IntelliSense to import any of the Components built into the library
theme: BasfThemes.lightMainTheme(BasfThemeType.darkBlue),
/// etc...
BasfColors.red,
/// etc...
Theme.of(context).textTheme.headline1!,
// headline2
// headline3
// headline4
// headline5
// headline6
// bodyText1
// bodyText2
// subtitle1
// subtitle2
// caption
// button
// overline
AppSnackBar.info(message: 'Button pressed').show(context);
// or
AppSnackBar.error(message: 'Button pressed').show(context);
BasfTextButton.contained(
text: 'Styled Button',
onPressed: () => _onPressed(context),
style: TextButton.styleFrom(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(0)),
backgroundColor: BasfColors.red,
),
),
// or
BasfTextButton.transparent(
context: context,
text: 'Expanded Button',
expanded: true,
onPressed: () => _onPressed(context),
),
// or
BasfTextButton.hint(
context: context,
text: 'Hint Button',
onPressed: () => _onPressed(context),
),
BasfOutlinedButton(
text: 'Outlined Buttons',
onPressed: () { /* --- */ },
);
BasfTextButton.transparent(
context: context,
text: 'Only Text',
onPressed: () => _onPressed(context),
),
SliderButton(
text: 'Basf Slider button',
onConfirmation: () {},
),
BasfTextButton.contained(
text: 'Text',
onPressed: () {
showDialog<void>(
context: context,
builder: (context) {
return const BasfAlertDialog(
title: 'Title',
description: 'Body Text',
confirmText: 'Confirm Text',
dismissText: 'Dismiss Text',
//onlyConfirm: true, // Optional to hide red text
);
},
);
},
);
BasfTextField(
decoration: const InputDecoration(
hintText: 'Enabled',
),
controller: _enabledController,
),
BasfDropDownInput(
controller: TextEditingController(),
values: const ['Option1', 'Option2', 'Option3'],
),
RadioOptions(
title: 'BASF Radio',
selectedValue: selectedValue,
labelGenerator: (o) => '$o',
values: values,
onSelected: (value) {
setState(() => selectedValue = value.toString());
},
),
BasfCheckbox(
value: selected, // Update this
onChanged: change,
// reverse: true, Optional
),
Icon(BasfIcons.add),
// or
Icon(BasfIconsData(code /* e842 */)),
Fade(
visible: value, // Update this value
child: Text('Sup'),
);
This extensions allows us to access a themedata based on the current context
final theme = context.theme; // Current ThemeData
This extension allows us to add a separator between each element of a List
Usage: joinWithSeparator
[
const Text('CARLOS'),
const Text('MOBILE SOLUTIONS'),
].joinWithSeparator(); // You can also specify your own separator Widget
//.joinWithSeparator(const SizedBox(height: 10));
This extension allows us to add a padding to a whole List, by default excludes flex Widgets, such as Expanded
, Spacer
or Flexible
Usage: spaced
[
const Text('CARLOS'),
const Text('MOBILE SOLUTIONS'),
].spaced(); // You can also specify your own EdgeInsetsGeometry
//.spaced(padding: const EdgeInsets.all(10));
This extensions emits a log event of the current object, and returns the length of the output log
Usage: log
final testString = 'My String';
testString.log();
// Outputs -> 'My String' as a log event
This set of extensions allows us to find an entry based on key, value, or both
Usage: where
, whereKey
and whereValue
<String, int>{'John': 20, 'Mary': 21, 'Peter': 20}
..where((key, value) => key.length > 4 && value >= 20) // {Peter: 22}
..whereKey((key) => key.length < 5) // {John: 20, Mary: 21}
..whereValue((value) => value.isEven); // {John: 20, Peter: 22}
This extensions allows us to safely capitalize or title-case a String
Usage: toCapitalized
and toTitleCase
'carlos g'.toCapitalized(); // Carlos g
'carlos g'.toTitleCase(); // Carlos G
You can find how to use all of this components at the example project