-
Notifications
You must be signed in to change notification settings - Fork 0
Components
Usage
Parameters
-
subtitle
: (Required) The text which is displayed in the expanded state. -
title
: (Required) Title of the Accordion.
Example
const TUIAccordion(
title: "Is this an accordion row?",
subtitle: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
);
Usage
Parameters
-
title
: (Required) Title of the TUIAnchor. -
onPressed
: The callback when the anchor is tapped.
Example
TUIAnchor(
title: "Link Text",
onPressed: () {
print("Anchor tapped");
},
);
TUIAppTopBar is a view that acts as a navigation bar for a screen. The view can be customized with title, left and right bar button items and with search
Usage
Parameters
-
currentIndex
: (Required) Currently selected index. -
items
: (Required) List of items List. -
showLabels
: (Required) Show or hide the label. -
onTap
: Selection changed callback.
Example
Scaffold(
bottomNavigationBar: TUIAppTopBar(
items: [
TUIAppBarItem(
iconData: FluentIcons.bookmark_24_regular, label: "Saved"),
TUIAppBarItem(
iconData: FluentIcons.search_24_regular, label: "Discover"),
TUIAppBarItem(iconData: FluentIcons.home_24_regular, label: "Home"),
TUIAppBarItem(
iconData: FluentIcons.person_24_regular, label: "Profile"),
TUIAppBarItem(
iconData: FluentIcons.settings_24_regular, label: "Settings"),
],
currentIndex: selectedBottomNavBarItem,
onTap: (value) => {
setState(() {
print("On tap, item selected: $value");
selectedBottomNavBarItem = value;
})
},
),
body: body: const Center(child: Text("hello")),
);
Represent file and document attachments with TUIAttachmentUpload. Supports title, image preview and actions to download and delete attachments.
Usage
Parameters
-
isIconUsed
: (Required) Show or hide the icon. -
title
: (Required) Title of the attachment upload widget. -
deleteTapped
: Callback when the delete is tapped. -
description
: Description of the widget. -
downloadTapped
: Callback when the download icon is tapped. -
icon
: Icon to be used inside the widget. -
image
: Image to be used inside the widget.
Example
TUIAttachmentUpload(
title: "Title",
isIconUsed: false,
image: TUIImage(
imageUrl: "https://images.unsplash.com/photo-1579353977828-2a4eab540b9a",
height: TUIMediaThumbnailSize.large.height,
width: TUIMediaThumbnailSize.large.width,
fit: BoxFit.fill,
),
);
Displays user avatar pics or initials.
Usage
Parameters
-
avatarContent
: (Required) Avatar content. This can contain either the icon, image, or text. -
-
type
(Required)
-
-
-
image
-
-
-
icon
-
-
-
text
-
-
icon
-
image
-
text
-
avatarSize
: (Required) Defines the size of the avatar. -
xxs
-
xs
-
s
-
m
-
l
-
xl
-
xxl
-
isBadged
: (Required) Show or hide the badge. -
backgroundColor
: Background Color of the widget, default value isColor(0xff924F92)
. -
foregroundColor
: Foreground color, default value isColor(0xffFFFFFF)
. -
textColor
: Text color of the Avatar text, default value isColor(0xffFFF5FF)
.
Example
Avatar with text
TUIAvatar(
avatarSize: TUIAvatarSize.xxl,
avatarContent: TUIAvatarContent(
text: "TUI",
type: TUIAvatarContentType.text,
),
);
Avatar with Icon and badge
TUIAvatar(
avatarSize: TUIAvatarSize.m,
avatarContent: TUIAvatarContent(
type: TUIAvatarContentType.icon,
icon: Symbol.export.value,
),
isBadged: true,
);
Avatar with Image and badge
TUIAvatar(
avatarSize: TUIAvatarSize.xxl,
backgroundColor: Colors.grey[200],
avatarContent: TUIAvatarContent(
type: TUIAvatarContentType.image,
image: const TUIImage(imageUrl: "https://avatars.githubusercontent.com/u/8043494?v=4"),
),
isBadged: true,
);
A view that displays a badge with an optional count. The badge is a pill shape with a background color of error and a text color of onError. The count is displayed in the center of the badge and is optional.
Can be used standalone, or as a view modifier to apply a badge on any view.
Usage
Parameters
-
badgeSize
: (Required) Defines the size of the badge. -
xs
-
s
-
l
-
isNumbered
: (Required) Is the badge number. -
content
: Text of the badge.
Example
TUIBadge(
isNumbered: true,
content: "1",
badgeSize: TUIBadgeSize.xs,
);
Usage
Parameters
-
onTap
: (Required) Callback for tap. -
titles
: (Required) Titles of the items.
Example
TUIBreadCrumb(
titles: const [
"one",
"two",
"three",
"four",
"five",
"six",
"seven",
"eight",
"nine",
"ten"
],
onTap: (index) {
print("The tapped index is ${index}");
},
);
Buttons with a variety of styles and sizes.
Usage
Parameters
-
type
: (Required) Button type, possible values are -
primary
-
secondary
-
outlined
-
ghost
-
danger
-
onPressed
: (Required) Callback for button pressed. -
height
: Height of the icon. -
iconData
: Icon of the button. -
iconPosition
: Position of the icon, possible values are: -
left
-
right
-
label
: Title of the button. -
onLongPress
: Callback for long press of the button. -
size
: Button size. -
xs
-
s
-
m
-
l
Example
TUIButton(
type: TUIButtonType.outlined,
label: "Success",
onPressed: () {
print ("Button pressed");
},
);
Usage
Parameters
-
enableMixedState
: Enable mixed state, default isfalse
. -
onChanged
: Callback for checkbox selection state. -
state
: Checkbox state, default isunchecked
. -
unchecked
-
mixed
-
checked
Example
TUICheckBox(
enableMixedState: true,
onChanged: (state) {
print("The tapped index is ${state}");
},
);
Component that displays a title and optional description, with a checkbox. Useful for displaying in lists with selectable items.
Usage
Parameters
-
title
: (Required) Title of the widget. -
backgroundDark
: To show dark background, uses themes background color. -
description
: Description of the widget. -
enableMixedState
: Enables the mixed state. -
onChanged
: Callback when checkbox selection is changed. -
state
: State of the widget. -
unchecked
-
mixed
-
checked
Example
TUICheckBoxRow(
enableMixedState: true,
title: "Title",
description: "Description",
state: TUICheckBoxRowState.checked,
onChanged: (state) {
print("The tapped index is $state");
}
);
Small button-like component, useful for displaying contextual information.
Usage
Parameters
-
title
: (Required) Title of the chip. -
size
: Size of the chip, default size ism
. -
m
-
l
-
badgeValue
: String value of the badge. -
highlighted
: Is the chip highlighted. -
leftIcon
: Left icon for the widget. -
leftIconImage
: Left image for the widget. -
onRightIconTap
: Callback when the right icon is tapped. -
rightIcon
: Right icon of the widget.
Example
TUIChip(
leftIcon: Icons.abc_outlined,
title: "Chip",
size: TUIChipSize.m,
rightIcon: Icons.access_alarm,
onRightIconTap: () {
print("Right Icon Tapped");
},
badgeValue: "4",
);
Display a divider in either horizontal or vertical orientation, with specified padding.
Usage
Parameters
-
type
: Type of TUIDivider, default is horizontal. -
horizontal
-
vertical
-
color
: Color of the divider. -
horizontalPadding
: Horizontal padding of the divider, default value is `none. -
none
-
s
-
m
-
l
-
xl
-
verticalPadding
: Vertical padding of the divider. -
none
-
s
Example
const TUIDivider(horizontalPadding: TUIDividerHorizontalPadding.s);
Component with a built-in drag handle, that can be used to contain components meant to be dragged, such as for re-ordering.
Usage
Parameters
-
backgroundDark
: To show dark background, uses themes background color. -
child
: Widget to be displayed insideTUIDraggableCard
.
Examples
- Without Dark Background
TUIDraggableCard(
child: Text("Hello"),
),
- With Dark Background
TUIDraggableCard(
backgroundDark: true,
child: Text("Hello"),
),
Full Example
import 'package:flutter/material.dart';
import 'package:tarka_ui/components/draggable_card/draggable_card.dart';
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: ListView(
children: [
TUIDraggableCard(
child: Text("Hello"),
),
TUIDraggableCard(
backgroundDark: true,
child: Text("Hello"),
),
],
),
),
);
}
}
Displays email addresses for use in email form to/cc fields.
Usage
Parameters
-
emails
: (Required) List of emails. -
label
: email type cc, bcc, or to. -
onAdd
: Callback when add is tapped. -
onRemove
: Callback when remove is tapped.
Example
TUIEmailField(
emails: [],
showSuffix: true,
onAdd: () {
print("Hello");
},
);
Useful for entering email subject lines.
Usage
Parameters
-
onTextChanged
: (Required) Callback for the text changes with the current string content.
Example
TUIEmailSubjectField(
onTextChanged: (String text) {
print("text changed: ${text}");
},
);
Floating action button with customisable sizes, colors and icons.
Usage
Parameters
-
iconData
: (Required) Icon for the floating action button. -
size
: (Required) Size of the Floating action button. -
large
-
regular
-
small
-
onPressed
: Callback when the floating action button is tapped.
Example
Scaffold(
floatingActionButton: TUIFloatingActionButton(
iconData: Symbol.map.value,
onPressed: () {},
),
body: const Center(child: Text("Example")),
);
Buttons containing only icons, to be used in toolbars and other places where space is a premium.
Usage
Parameters
-
iconData
: (Required) Icon for the Button. -
size
: (Required)TUIIconButtonSize
is used to define the size of button. -
px20
-
px24
-
px32
-
px40
-
px48
-
type
: (Required)TUIIconButtonType
is used to define the type of button. -
primary
-
secondary
-
outlined
-
ghost
-
onLongPress
: Called when the button is long-pressed. -
onPressed
: Called when the button is tapped or otherwise activated.
Example
TUIIconButton(
type: TUIIconButtonType.primary,
size: TUIIconButtonSize.px20,
onPressed: () {},
iconData: Symbol.documentDownload.value
);
Component for text input, with a title and multiple configuration options - including trailing action buttons, focus highlighting, error or other helper text, and more.
Usage
Parameters
-
enabled
: Defaults totrue
. -
readOnly
: Defaults tofalse
. -
hintText
: Defaults tonull
. -
labelText
: Defaults to"label"
. -
errorText
: Defaults tonull
. -
prefixText
: Defaults tonull
. -
suffixText
: Defaults tonull
. -
textAlign
: Defaults toTextAlign.start
. -
textAlignVertical
: Defaults toTextAlignVertical.center
. -
textCapitalization
: Defaults toTextCapitalization.none
. -
textDirection
: Defaults toTextDirection.ltr
. -
maxLines
: Defaults to1
. -
minLines
: Defaults tonull
. -
expands
: Defaults tofalse
. -
maxLength
: Defaults tonull
. -
prefixIcon
: Defaults tonull
. -
prefixIconColor
: Defaults toColor(0xff1A1B1F)
. -
suffixIcon
Defaults tonull
. -
suffixIconColor
: Defaults toColor(0xff1A1B1F)
. -
obscureText
: Defaults tofalse
. -
obscuringCharacter
: Defaults to"*"
. -
controller
:TextEditingController
defaults tonull
. -
keyboardType
: Defaults tonull
. -
textInputAction
: Defaults tonull
. -
onChanged
: Callback for the text change event with the current string. -
onEditingComplete
: Callback when the editing is completed. -
onSubmitted
: Callback when the submit button is pressed. -
onTap
: Callback when the widget is tapped.
Example
const TUIInputField(
hintText: "Label",
labelText: "Hello World",
errorText: "Error message goes here.",
);
Usage
Parameters
-
mediaType
: (Required) Media type photo, video, document, audio. -
photo
-
video
-
document
-
audio
-
size
: (Required) Size of the media thumbnail. It can be large or regular. -
large
-
regular
-
customThumbnailImage
: Image for the thumbnail. -
isSelectable
: Is the media thumbnail selectable, default istrue
. -
onPressed
: Callback when the thumbnail is tapped.
Example
TUIMediaThumbnail(
size: TUIMediaThumbnailSize.large,
mediaType: TUIMediaThumbnailType.video,
onPressed: () {
print("Video thumbnail tapped.");
},
customThumbnailImage: TUIImage(
imageUrl:"https://images.unsplash.com/photo-1579353977828-2a4eab540b9a",
height: TUIMediaThumbnailSize.large.height,
width: TUIMediaThumbnailSize.large.width,
fit: BoxFit.fill,
),
);
Use TUIMenuItem for individual menu options in a TUIMobileOverlayMenu
.
Usage
Parameters
-
item
: (Required) -
-
title
: (Required) Title of the menu item.
-
-
-
style
: (Required) Menu item style -none
,onlyLeft
,onlyRight
andboth
.
-
-
-
none
-
-
-
onlyLeft
-
-
-
onlyRight
-
-
-
both
-
-
-
state
: Default isunchecked
.
-
-
-
unchecked
-
-
-
leftChecked
-
-
-
rightChecked
-
-
-
bothChecked
-
-
backgroundDark
: Is the dark theme used, default value isfalse
. -
action
: Callback when the menu item is tapped. -
onLeftTap
: Callback when the left icon is tapped. -
onRightTap
: Callback when the right icon is tapped.
Example
TUIMenuItem(
item: TUIMenuItemProperties(
title: "Item",
style: TUIMenuItemStyle.none,
),
action: (state) {
print("hello");
},
);
Use TUIMobileOverlayFooter to display the title at the top of an overlay.
Usage
Parameters
-
style
(Required): -
-
style
: (Required)
-
-
-
handle
-
-
-
onlyTitle
-
-
-
left
-
-
-
right
-
-
-
title
: Title of the overlay header.
-
-
-
action
: Callback for the header tapped.
-
-
-
icon
: Right icon for the header.
-
Example
TUIMobileOverlayHeader(
style: TUIOverlayMobileStyle(
style: TUIOverlayMobileStyleType.left,
title: "Hello",
action: () {
print("hello tapped");
},
),
);
Depicts items that navigate to other screens when tapped.
Usage
Parameters
-
title
: (Required) Title of the widget. -
accessoryView
: Right side widget. -
icon
: Left Icon for the widget.
Example
TUINavigationRow(
title: "hello world, hello world, hello world, hello world, hello world, hello world, hello world, ",
icon: FluentIcons.fluent_20_filled,
accessoryView: Container(
width: 80,
height: 60,
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(
color: Colors.yellow,
borderRadius: BorderRadius.circular(8.0),
),
),
);
When presenting the user with multiple choices requiring a single selection, TUIRadioRow can be used.
Usage Parameters
-
onPressed
: Callback when the radio button is pressed. -
isSelected
: Defines if the Radio Button is selected programatically or not, defaults tofalse
.
Example
TUIRadioButton(
onPressed: () {
print("Anchor tapped");
},
);
Usage
Parameters
-
max
: (Required) Maximum value of the slider. -
min
: (Required) Minimum value of the slider. -
values
: (Required) Contains the range of the Slider typeRangeValues
. -
onChanged
: Callback when the value of the slider changes. -
onChangeEnd
: Callback that is called when a value change is complete. -
onChangeStart
: Callback that is called when a value change begins.
Example
TUIRangeSlider(
values: rangeSliderValue,
onChanged: (value) {
updateRangeSliderValue(value);
},
onChangeStart: (value) => {print("Range change Started $value")},
onChangeEnd: (value) => {print("Range change Ended $value")},
max: 1,
min: 0,
);
Usage
Parameters
-
isSelected
- Default: false, Sets background color to selected. Uses theme colorsurface
ifisHovered
false andprimaryAltHover
ifisHovered
is true. -
isHovered
- Default: false, Sets background color to hovered. Uses theme colorsurfaceHover
ifisSelected
false andprimaryAltHover
ifisSelected
is true. -
showChevron
- To hide or show chevron on right. -
icon
- Custom icon for card. -
badgeCount
- Count to show on badge. If nothing passed it will hidden. -
badgeColor
- Background Color of show on badge. -
action
- Custom action or function on tap. -
style
- (Required).TUISelectionCardStyle
-
-
title
- (Required). Title to display.
-
-
-
description
- List of strings to be displayed as description.
-
-
-
footer
- String to display in footer.
-
Example
TUISelectionCard(
style: TUISelectionCardStyle(
title: "Label",
description: ["Description", "Description"],
footer: "Label",
),
icon: FluentIcons.guest_24_regular,
badgeColor: Colors.green,
badgeCount: 4,
action: () {
print("hello");
},
);
A view that displays a message for a brief period of time and then disappears automatically. Use a snackbar to display a brief message at the bottom of the screen. Snackbars appear above all other elements on screen and only one can be displayed at a time.
Usage Parameters
-
type
: Type of the snack bar, possible types:success
,information
,warning
, anderror
. -
message
: String content of the snack bar. -
action
: -
label
-
onActionPressed
-
duration
: Callback that is called when a value change begins. -
onVisible
: Callback when the snack bar is visible.
Example
TUISnackBar(
context: context,
type: TUISnackBarType.error,
message: "This is an error Snackbar with action",
action: TUISnackBarAction(
label: "Retry",
onActionPressed: () {
print("Snackbar Retry onPressed");
}),
);
Usage
Parameters
-
max
: (Required) Maximum value of the slider. -
min
: (Required) Minimum value of the slider. -
value
: (Required) Current value of the slider. -
onChanged
: Callback when the value changes. -
onChangeStart
: Callback when the value change begins. -
onChangeEnd
: Callback when the value change ends.
Example
TUISlider(
value: sliderValue,
onChanged: (value) {
updateSliderValue(value);
},
max: 1,
min: 0,
);
Usage
Example
const TUISuccessCheckMark(),
Usage
Parameters
-
title
- (Required) Title text -
description
- Long Text as description -
icon
- Icon to show on left, if nothing passed it be treated as hidden -
value
- Value of switch -
onChanged
- Callback when switch selection changed. -
backgroundDark
- To show dark background, uses themes background color.
Example
TUIToggleRow(
title: "Title",
description:
"Descrption for this menu item that goes upto two lines",
value: false,
icon: const Icon(FluentIcons.guest_24_filled),
backgroundDark: true,
onChanged: (value) {
setState(() {
_enable = value;
});
},
);
Customised switch control matching the Tarka UI Kit theme, with enabled and disabled styles
Usage
Parameters
-
value
: (Required) Value of the switch. -
onChanged
: Callback when the switch state is changed.
Example
TUISwitch(
value: _enable,
onChanged: (bool val) {
setState(() {
_enable = val;
});
},
);
Useful for showing contextual information that is read-only.
Usage
Parameters
-
tagIconType
: (Required) TUITagIconType is used to define the position of the icon in the tag. -
none
-
left
-
right
-
tagSize
: (Required) IconSize, leftPadding, rightPadding, space between icon and text, tag height, text style, and vertical padding are computed based on tag size. -
tagText
: (Required) Content of the tag. -
tagContrast
: The text color and icon color are computed based on contrast, default value isTUITagContrast.low
. -
low
-
high
Example
TUITag(
tagSize: TUITagSize.s,
tagText: "Label",
tagIconType: TUITagIconType.none,
);