artemis_ui_kit 0.0.18 artemis_ui_kit: ^0.0.18 copied to clipboard
Some Widgets base on Artemis StyleGuide
import 'package:artemis_ui_kit/artemis_ui_kit.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
bool radioButtonValue = false;
bool checkBoxButtonValue = false;
bool switchButtonValue = false;
DateTime time = DateTime.now();
String selectedStr = "1";
int panelValue = 0;
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: SingleChildScrollView(
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: ArtemisDropDown<String>(
hint: "Hello",
showSearch: true,
items: ["a2","a3","a4",],
itemAsString: (e)=>e, label: null),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: ArtemisTextField(
label: "Test",
showError: false,
locked: false,
disabled: false,
showConfirm: true,
validator: (str) => str.isNotEmpty,
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: ArtemisDropDown<String>(
items: [
"1",
"2",
"3",
],
label: "Test",
itemAsString: (item) => item,
onChanged: (s) {
print(s);
},
selectedItem: selectedStr,
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: ArtemisExpansionTile(
title: Text("Test"),
children: [
Text("1"),
Text("1"),
Text("1"),
Text("1"),
Text("1"),
],
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: ArtemisRadioButton(
label: "Test",
value: radioButtonValue,
labelWidget: Icon(Icons.share),
onChanged: (v) {
setState(() {
radioButtonValue = v;
});
},
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: ArtemisCheckBox(
label: "Test",
value: checkBoxButtonValue,
checkBoxAtEnd: true,
// labelWidget: Icon(Icons.share),
onChanged: (v) {
setState(() {
checkBoxButtonValue = v;
});
},
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: ArtemisButtonPanel(
centerAction: () {
print(panelValue);
},
rightAction: () {
setState(() {
panelValue++;
});
},
leftAction: () {
setState(() {
panelValue--;
});
},
rightWidget: Icon(ArtemisIcons.rightArrow),
centerWidget: Text("$panelValue"),
leftWidget: Icon(ArtemisIcons.leftArrow),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: ArtemisCardField(
title: 'Test',
value: '123',
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: ArtemisSwitch(
value: switchButtonValue,
switchAtEnd: true,
label: 'Test',
onChanged: (value) {
setState(() {
switchButtonValue = value;
});
},
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: ArtemisButton(
label: 'Test',
onPressed: () {},
bordered: true,
radius: 20,
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: ArtemisTimeField(
onChange: () {
showDialog(
context: context,
builder: (c) => ArtemisTimePickerDialog())
.then((value) {
if (value != null) {
setState(() {
time = value;
});
}
});
},
label: 'Test',
value: DateFormat("hh:mm").format(time),
),
),
],
),
),
),
);
}
}