karot_components 0.0.5 karot_components: ^0.0.5 copied to clipboard
Karot UI Component Languages.
import 'package:flutter/material.dart';
import 'package:karot_components/card/karot_card.dart';
import 'package:karot_components/card/karot_card_primary.dart';
import 'package:karot_components/card/karot_card_banner.dart';
import 'package:karot_components/card/karot_card_short.dart';
import 'package:karot_components/cell/cell_product.dart';
import 'package:karot_components/cell/cell_product_fresh.dart';
import 'package:karot_components/dialog/karot_show_card_info_dialog.dart';
import 'package:karot_components/constant/dialog_enum.dart';
import 'package:karot_components/constant/theme.dart';
import 'package:karot_components/label/karot_note.dart';
import 'package:karot_components/label/karot_label.dart';
import 'package:karot_components/sider/karot_slider.dart';
import 'package:karot_components/button/karot_button.dart';
import 'package:karot_components/button/karot_icon_button.dart';
import 'package:karot_components/button/karot_text_button.dart';
import 'package:karot_components/constant/button_enum.dart';
import 'package:karot_components/constant/text_enum.dart';
void main() {
runApp(const MaterialApp(debugShowCheckedModeBanner: false, home: MyApp()));
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// String _platformVersion = 'Unknown';
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: const Color(0xFFE91A4D),
title: const Text('Flutter Karot Components'),
),
body: SingleChildScrollView(
padding: const EdgeInsets.all(10),
child: Column(children: [
const SizedBox(height: 40),
const KRLabel(
text: "Button Section", size: KRTextSize.title, isBold: true),
const Divider(),
KRButton(
text: "Hello World",
isFull: false,
isOutline: false,
isBold: false,
size: KRButtonSize.small,
onPressed: () {}),
KRButton(
text: "Disabled Button",
isFull: false,
isOutline: false,
isBold: false,
isDisabled: true,
size: KRButtonSize.small,
onPressed: () {}),
KRButton(
text: "Hello World",
isFull: false,
isOutline: false,
isBold: false,
size: KRButtonSize.regular,
onPressed: () {}),
KRButton(
text: "Hello World",
isFull: false,
isOutline: false,
isBold: false,
size: KRButtonSize.large,
onPressed: () {}),
KRButton(
text: "Hello World",
isFull: true,
isOutline: true,
isBold: false,
size: KRButtonSize.small,
onPressed: () {}),
KRButton(
text: "Hello World",
isFull: true,
isOutline: false,
isBold: false,
size: KRButtonSize.regular,
onPressed: () {}),
KRButton(
text: "Hello World",
isFull: true,
isOutline: true,
isBold: false,
size: KRButtonSize.large,
onPressed: () {}),
KRIconButton(
backgroundColor: KRTheme.DEFAULT_PRIMARY_LIGHT_COLOR,
color: KRTheme.DEFAULT_GREY_COLOR,
isDisabled: true,
iconData: Icons.favorite_border_rounded,
isOutline: false,
size: KRButtonSize.small,
onPressed: () {}),
KRIconButton(
color: KRTheme.DEFAULT_DARK_COLOR,
iconData: Icons.favorite,
isOutline: false,
size: KRButtonSize.regular,
onPressed: () {}),
KRIconButton(
color: KRTheme.DEFAULT_PRIMARY_COLOR,
iconData: Icons.favorite,
isOutline: true,
size: KRButtonSize.large,
onPressed: () {}),
KRButton(
text: "Hello World",
isFull: false,
isOutline: true,
isBold: false,
size: KRButtonSize.small,
onPressed: () {}),
KRButton(
text: "Hello World",
isFull: false,
isOutline: false,
isBold: false,
size: KRButtonSize.regular,
onPressed: () {}),
KRButton(
text: "Hello World",
isFull: false,
isOutline: true,
isBold: false,
size: KRButtonSize.large,
onPressed: () {}),
KRButton(
text: "Hello World Bold",
isFull: false,
isOutline: false,
isBold: true,
size: KRButtonSize.regular,
onPressed: () {}),
KRButton(
text: "Hello World Normal",
isFull: false,
isOutline: false,
isBold: false,
size: KRButtonSize.regular,
onPressed: () {}),
const SizedBox(height: 40),
const KRLabel(
text: "Text Button Section",
size: KRTextSize.title,
isBold: true),
const Divider(),
const SizedBox(height: 40),
KRTextButton(
text: "Text Button",
isBold: true,
isDisabled: true,
size: KRButtonSize.small,
onPressed: () {}),
KRTextButton(
text: "Text Button",
isBold: true,
size: KRButtonSize.regular,
onPressed: () {}),
KRTextButton(
text: "Text Button",
isBold: true,
size: KRButtonSize.large,
onPressed: () {}),
const SizedBox(height: 40),
const KRLabel(text: "Note", size: KRTextSize.title, isBold: true),
const Divider(),
const SizedBox(height: 40),
const KRNote(
text:
"Hello world, this component is used simplified performance and faster development"),
const SizedBox(height: 20),
const KRNote(
text:
"Hello world, this component is used simplified performance and faster development",
textColor: KRTheme.DEFAULT_PRIMARY_COLOR,
textAlign: TextAlign.center),
const SizedBox(height: 20),
const KRNote(
text:
"Hello world, this component is used simplified performance and faster development",
textAlign: TextAlign.right),
const KRLabel(
text: "Slider Section", size: KRTextSize.title, isBold: true),
KRSlider(label: const Text("Hi There")),
const SizedBox(height: 40),
const KRLabel(
text: "Dialog Section", size: KRTextSize.title, isBold: true),
const Divider(),
const SizedBox(height: 40),
KRButton(
backgroundColor: 0xFF3789E7,
text: "Show Info Dialog",
isFull: false,
isOutline: false,
isBold: false,
size: KRButtonSize.large,
onPressed: () {
KRCardInfoDialog.showKarotAlertDialog(context,
dialogType: KRDialog.info,
title: "Congra !!!",
bodyText:
"Hello world, this component is used simplified performance and faster development",
onDismissTap: () {});
}),
KRButton(
backgroundColor: 0xFFF90909,
text: "Show Error Dialog",
isFull: false,
isOutline: false,
isBold: false,
size: KRButtonSize.large,
onPressed: () {
KRCardInfoDialog.showKarotAlertDialog(context,
dialogType: KRDialog.error,
title: "Congra !!!",
bodyText:
"Hello world, this component is used simplified performance and faster development",
onDismissTap: () {});
}),
KRButton(
backgroundColor: 0xFF37E75D,
text: "Show Success Dialog",
isFull: false,
isOutline: false,
isBold: false,
size: KRButtonSize.large,
onPressed: () {
KRCardInfoDialog.showKarotAlertDialog(context,
dialogType: KRDialog.sucess,
title: "Congra !!!",
bodyText:
"Hello world, this component is used simplified performance and faster development",
dismissText: "Next",
onDismissTap: () {});
}),
KRButton(
backgroundColor: 0xFFE79537,
text: "Show Warning Dialog",
isFull: false,
isOutline: false,
isBold: false,
size: KRButtonSize.large,
onPressed: () {
KRCardInfoDialog.showKarotAlertDialog(context,
dialogType: KRDialog.warning,
title: "Congra !!!",
bodyText:
"Hello world, this component is used simplified performance and faster development",
onDismissTap: () {});
}),
KRButton(
text: "Show Alert Dialog",
isFull: false,
isOutline: false,
isBold: false,
size: KRButtonSize.large,
onPressed: () {
KRCardInfoDialog.showKarotAlertDialog(context,
dialogType: KRDialog.warning,
title: "Congra !!!",
bodyText:
"Hello world, this component is used simplified performance and faster development",
dismissText: "OK",
onDismissTap: () {});
}),
KRButton(
text: "Show Dialog",
isFull: false,
isOutline: false,
isBold: false,
size: KRButtonSize.large,
onPressed: () {
KRCardInfoDialog.showKarotAlertDialog(context,
title: "Congra !!!",
bodyText:
"Hello world, this component is used simplified performance and faster development",
onConfirmTap:() {},
dismissText: "OK",
onDismissTap: () {});
}),
const SizedBox(height: 40),
const KRLabel(
text: "Card Section", size: KRTextSize.title, isBold: true),
const Divider(),
const SizedBox(height: 40),
KRCard(
title: "Popular Item",
child: Column(
children: [
const KRNote(
text:
"Hello world, this component is used simplified performance and faster development",
textColor: KRTheme.DEFAULT_PRIMARY_COLOR,
textAlign: TextAlign.center),
const SizedBox(height: 20),
KRButton(
text: "YeS Man",
isFull: true,
isOutline: false,
isBold: false,
size: KRButtonSize.large,
onPressed: () {})
],
),
),
const SizedBox(height: 20),
KRCardPrimary(
title: "Good DeaL",
subtitle: "Popular Item",
child: Column(
children: [
const KRNote(
text:
"Hello world, this component is used simplified performance and faster development",
textColor: KRTheme.DEFAULT_PRIMARY_COLOR,
textAlign: TextAlign.center),
const SizedBox(height: 20),
KRButton(
text: "YeS Man",
isFull: true,
isOutline: false,
isBold: false,
size: KRButtonSize.large,
onPressed: () {})
],
),
),
const SizedBox(height: 20),
KRCardPrimary(
gradientColor: const [
Color(KRTheme.DEFAULT_PRIMARY_LIGHT_COLOR),
Color(KRTheme.DEFAULT_PRIMARY_COLOR)
],
title: "Good DeaL",
subtitle: "Popular Item",
child: Column(
children: [
const KRNote(
text:
"Hello world, this component is used simplified performance and faster development",
textColor: KRTheme.DEFAULT_PRIMARY_COLOR,
textAlign: TextAlign.center),
const SizedBox(height: 20),
KRButton(
text: "YeS Man",
isFull: true,
isOutline: false,
isBold: false,
size: KRButtonSize.large,
onPressed: () {})
],
),
),
const SizedBox(height: 20),
const KRCardBanner(
title: "Seta ! got 50%", bodyText: "use code ! 000001"),
const SizedBox(height: 20),
KRCardBanner(
title: "Seta ! got 50%",
bodyText: "use code ! 000001",
tailingWidget: KRButton(
text: "Hello World",
isFull: false,
isOutline: false,
isBold: false,
size: KRButtonSize.small,
onPressed: () {}),
),
const SizedBox(height: 20),
// KRCardShort(title: "Siliver Member", bodyText: "50 Points", iconData: Icons.star),
Row(
children: [
const Flexible(
child: KRCardShort(
title: "Siliver Member",
bodyText: "50 Points",
iconData: Icons.star)),
const SizedBox(width: 10),
Flexible(
child: KRCardShort(
title: "Enjoy Daily",
bodyText: "Vouchers",
iconData: Icons.money_rounded,
onTap: () {}))
],
),
const SizedBox(height: 40),
const KRLabel(
text: "Cell Section", size: KRTextSize.title, isBold: true),
const Divider(),
const SizedBox(height: 40),
SizedBox(
height: 240,
width: MediaQuery.of(context).size.width,
child: ListView(
scrollDirection: Axis.horizontal,
children: const [
KRCellProduct(
isFavorite: true,
padding: EdgeInsets.only(left: 5),
imgURL:
"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRiTILpCmxhFvTZr0hZbReynwUQL8ZcMKu3XhrV_Gc3eaQDs-NgvYgka1IaRTeZmDWYUao&usqp=CAU",
title: "15 \$ / Kilo",
caption: "min 0.5Kg",
subtitle: "chees burger asdfasd fasdfasdf asdfasdfa sdfasdfasdf ass"),
KRCellProduct(
cartCountText: "2",
discountText: "15%\nOFF",
padding: EdgeInsets.only(left: 5),
imgURL:
"https://froots.co/wp-content/uploads/2021/06/Froots-Baby-Spinach.png",
title: "15 \$ / Kilo",
caption: "min 0.5Kg",
subtitle: "chees burger"),
KRCellProduct(
padding: EdgeInsets.only(left: 5),
imgURL:
"https://froots.co/wp-content/uploads/2021/06/Froots-Baby-Spinach.png",
title: "15 \$ / Kilo",
caption: "min 0.5Kg",
subtitle: "chees burger")
],
),
),
SizedBox(
height: 300,
width: MediaQuery.of(context).size.width,
child: ListView(
scrollDirection: Axis.horizontal,
children: const [
KRCellProductFresh(
freshImages: ["https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRiTILpCmxhFvTZr0hZbReynwUQL8ZcMKu3XhrV_Gc3eaQDs-NgvYgka1IaRTeZmDWYUao&usqp=CAU", "https://froots.co/wp-content/uploads/2021/06/Froots-Baby-Spinach.png"],
padding: EdgeInsets.only(left: 5),
imgURL:
"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRiTILpCmxhFvTZr0hZbReynwUQL8ZcMKu3XhrV_Gc3eaQDs-NgvYgka1IaRTeZmDWYUao&usqp=CAU",
title: "15 \$ / Kilo",
caption: "min 0.5Kg",
subtitle: "chees burger asdfasdf asdfasdfa asdfasdf asdfasd")
],
),
)
]),
),
);
}
}