digit_ui_components 0.0.2-dev.1 digit_ui_components: ^0.0.2-dev.1 copied to clipboard
Digit UI Design specification
digit ui components #
Flutter Common UI Widgets #
Digit UI Components is a collection of common Flutter widgets designed to simplify UI development. These components offer easy-to-use and customizable features to enhance UI design and streamline the development process.
Installation #
Add this to your pubspec.yaml
file:
dependencies:
digit_ui_components: 1.0.0
Then run:
flutter pub get
Usage #
Import the package in your Dart code:
import 'package:digit_ui_components/digit_components.dart';
Example #
Text Input Variants #
Digit UI Components includes various text input fields with optional features such as character count display, inner labels, and help text. These fields also come with built-in validation support for improved data integrity.
Text Input Field
DigitTextFormInput(
label: "Text Field",
initialValue: 'value',
controller: TextEditingController(),
innerLabel: 'label',
helpText: 'help text',
charCount: true,
);
Date Input Field
DigitDateFormInput(
label: "Date Field",
controller: TextEditingController(),
innerLabel: 'innerlabel',
helpText: 'help text',
);
Time Input Field
DigitTimeFormInput(
label: "Time Field",
controller: TextEditingController(),
innerLabel: 'innerlabel',
helpText: 'help text',
);
Location Input Field
DigitLocationFormInput(
label: "Location Field",
controller: TextEditingController(),
innerLabel: 'innerlabel',
helpText: 'help text',
);
Numeric Input Field
DigitNumericFormInput(
label: "Numeric Field",
controller: TextEditingController(),
innerLabel: 'innerlabel',
helpText: 'help text',
initialValue: '0',
step: 1,
);
Password Input Field
DigitPasswordFormInput(
label: "password Field",
controller: TextEditingController(),
innerLabel: 'innerlabel',
helpText: 'help text',
validations: [
Validator(ValidatorType.minLength, 6,
errorMessage:
'Password must be at least 6 characters.'),
],
);
Search Input Field
DigitSearchFormInput(
label: "Search Field",
controller: TextEditingController(),
innerLabel: 'innerlabel',
helpText: 'help text',
onSuffixTap: (value){},
);
TextArea Input Field
DigitTextAreaFormInput(
label: "Text Area",
controller: TextEditingController(),
innerLabel: 'innerlabel',
helpText: 'help text',
);
DigitButton Variants #
Digit UI Components provides a variety of DigitButtons with optional suffix and prefix icons, contributing to a cohesive and visually appealing UI.
Primary DigitButton
DigitButton(
label: 'Primary DigitButton',
onPressed: () {},
type: DigitButtonType.primary,
);
with Suffix Icon
DigitButton(
suffixIcon: Icons.add,
label: 'Primary DigitButton',
onPressed: () {},
type: DigitButtonType.primary,
);
Secondary DigitButton
DigitButton(
label: 'secondary DigitButton',
onPressed: () {},
type: DigitButtonType.secondary,
);
Tertiary DigitButton
DigitButton(
label: 'tertiary DigitButton',
onPressed: () {},
type: DigitButtonType.tertiary,
);
Link
DigitButton(
label: 'link',
onPressed: () {},
type: DigitButtonType.link,
);
Radio DigitButtons #
The Radio DigitButtons component in Digit UI Components empowers users to make a single selection from a list of options. This intuitive interface provides a smooth user experience with hover and mouse-down effects.
RadioList(
onChanged: (value) {},
groupValue: '1',
radioDigitButtons: [
RadioDigitButtonModel(code: '1',name: 'One',),
RadioDigitButtonModel(code: '2', name: 'Two'),
RadioDigitButtonModel(code: '3', name: 'Three'),
],
);
Toggle DigitButtons #
The Toggle DigitButtons component in Digit UI Components presents a list of interactive toggle DigitButtons, providing users with the ability to select a option. Each DigitButton is equipped with callbacks for both mouse-down and hover effects, ensuring a responsive and engaging user interface.
ToggleList(
toggleDigitButtons: [
ToggleDigitButtonModel(
name: 'Toggle 1', key: 'key1', onSelected: (value) {}),
ToggleDigitButtonModel(
name: 'Toggle 2', key: 'key2', onSelected: (value) {}),
ToggleDigitButtonModel(
name: 'Toggle 3', key: 'key3', onSelected: (value) {}),
],
selectedIndex: 1,
onChanged: (selectedValues) {},
);
Dropdown Variants #
Digit UI Components offers various dropdown menus, including single-select, multi-select, and tree-select options.
Single Select Dropdown
The Single Select Dropdown in Digit UI Components provides a dropdown menu for users to make a single selection. This intuitive component supports options with additional features such as images, icons, and descriptions, complemented by hover and mouse-down effects.
DigitDropdown<int>(
onChange: (String value, String index) => {},
textEditingController: TextEditingController(),
items: const [
DropdownItem(name: 'first',code: '1',),
DropdownItem(name: 'second',code: '2',),
DropdownItem(name: 'third',code: '3',),
DropdownItem(name: 'fourth',code: '4',
),
],
);
With description and profile Image
DigitDropdown<int>(
onChange: (String value, String index) => {},
textEditingController: TextEditingController(),
items: const [
DropdownItem(
name: 'first',
code: '1',
description: 'description for first one',
profileImage: NetworkImage(
'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSzBXNuO6PezhC18aYH_2cYtS0I7KbxoKYdwA&usqp=CAU',
),
),
DropdownItem(
name: 'second',
code: '2',
description: 'description for second one',
profileImage: NetworkImage(
'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSzBXNuO6PezhC18aYH_2cYtS0I7KbxoKYdwA&usqp=CAU',
),
),
DropdownItem(
name: 'third',
code: '3',
description: 'description for third one',
profileImage: NetworkImage(
'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSzBXNuO6PezhC18aYH_2cYtS0I7KbxoKYdwA&usqp=CAU',
),
),
DropdownItem(
name: 'fourth',
code: '4',
description: 'description for fourth one',
profileImage: NetworkImage(
'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSzBXNuO6PezhC18aYH_2cYtS0I7KbxoKYdwA&usqp=CAU',
),
),
],
);
With Different Type of Options
DigitDropdown<int>(
onChange: (String value, String index) => {},
textEditingController: TextEditingController(),
dropdownType: DropdownType.nestedSelect,
items: const [
DropdownItem(name: 'first',code: '1',type: 'Type A',),
DropdownItem(name: 'second',code: '2',type: 'Type B'),
DropdownItem(name: 'third',code: '3',type: 'Type A',),
DropdownItem(name: 'fourth',code: '4',type: 'Type B'),
],
);
Multi Select Dropdown
The Multi Select Dropdown in Digit UI Components offers a user-friendly interface for selecting multiple options simultaneously. This clean and intuitive component is equipped with built-in chips and provides responsive mouse-down and hover effects.
MultiSelectDropDown<int>(
onOptionSelected: (List<DropdownItem> selectedOptions) {},
options: const [
DropdownItem(code: '1', name: 'first'),
DropdownItem(code: '2', name: 'second'),
DropdownItem(code: '3', name: 'third'),
DropdownItem(code: '4', name: 'four'),
],
);
Tree Select Dropdown
A hierarchical dropdown menu enabling single or multiple selections from a tree-like structure.
Single Select Option
TreeSelectDropDown<int>(
onOptionSelected: (List<TreeNode> selectedOptions) {},
options: [
TreeNode('C', 'C', [
TreeNode('C.C1', 'C1', []),
TreeNode('C.C2', 'C2', []),
]),
TreeNode('D', 'D', [
TreeNode('D.D1', 'D1', []),
TreeNode('D.D2', 'D2', []),
]),
],
controller: TreeSelectController(),
);
Multi Select Option
TreeSelectDropDown<int>(
onOptionSelected: (List<TreeNode> selectedOptions) {},
options: [
TreeNode('C', 'C', [
TreeNode('C.C1', 'C1', []),
TreeNode('C.C2', 'C2', []),
]),
TreeNode('D', 'D', [
TreeNode('D.D1', 'D1', []),
TreeNode('D.D2', 'D2', []),
]),
],
treeSelectionType: TreeSelectionType.MultiSelect,
controller: TreeSelectController(),
);
Toast #
The toast component is used for displaying toast messages with various types such as success, error, and warning.
Success toast
Toast.show(context,
options: ToastOptions(
"Your Warning message", ToastType.success));
error toast
Toast.show(context,
options: ToastOptions(
"Your Warning message", ToastType.error));
Warning toast
Toast.show(context,
options: ToastOptions(
"Your Warning message", ToastType.warning));
Info Card #
InfoCard is a versatile widget designed to showcase informational content in a visually appealing manner. It is commonly used to display messages, alerts, or other important information. The card supports various customization options to adapt to different use cases.
Info card
InfoCard(
title: 'Info',
type: InfoType.info,
description:
'Application process will take a minute to complete. It might cost around Rs.500/- to Rs.1000/- to clean your septic tank and you can expect theservice to get completed in 24 hrs from the time of payment.',
),
Success card
InfoCard(
title: 'Success',
type: InfoType.success,
description:
'Application process will take a minute to complete. It might cost around Rs.500/- to Rs.1000/- to clean your septic tank and you can expect theservice to get completed in 24 hrs from the time of payment.',
),
Warning card
InfoCard(
title: 'Warning',
type: InfoType.warning,
description:
'Application process will take a minute to complete. It might cost around Rs.500/- to Rs.1000/- to clean your septic tank and you can expect theservice to get completed in 24 hrs from the time of payment.',
),
Error card
InfoCard(
title: 'Error',
type: InfoType.error,
description:
'Application process will take a minute to complete. It might cost around Rs.500/- to Rs.1000/- to clean your septic tank and you can expect theservice to get completed in 24 hrs from the time of payment.',
),