flutter_kingmed_ui 0.0.3 flutter_kingmed_ui: ^0.0.3 copied to clipboard
A new KingMed UI package.
import 'package:example/page/drop_down_page.dart';
import 'package:example/page/step_page.dart';
import 'package:example/page/tab_test.dart';
import 'package:flutter/material.dart';
import 'package:flutter_kingmed_ui/flutter_kingmed_ui.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home:MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
GlobalKey key1=new GlobalKey();
@override
void initState() {
// TODO: implement initState
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Container(
padding: EdgeInsets.all(12),
child: Column(
children: [
SizedBox(
height: 20,
),
Wrap(
children: [
TextButton(onPressed: () {showSwitchHiintDialog();}, child: Text('不再提示弹窗')),
TextButton(onPressed: () {showLoading();}, child: Text('loading')),
TextButton(onPressed: () {showSpinLoading();}, child: Text('loading spin')),
TextButton(onPressed: () {showLoadingText();}, child: Text('页面加载带文字')),
StatusWidget(),
PartLoadView(
loadWidth: 100,
child: Container(
alignment: Alignment.center,
child: Icon(Icons.local_shipping,size: 50,),
),isLoad: true,),
TextButton(onPressed: () {showIconHintDialog();}, child: Text('信息展示弹窗')),
TextButton(onPressed: () {pageToTabBar();}, child: Text('自定义tabbar')),
TextButton(onPressed: () {pageToDrodown();}, child: Text('下拉弹框')),
TextButton(onPressed: () {pageToStepView();}, child: Text('步骤条')),
Row(
children: [
TextButton(onPressed: () {MessageSnackBar.showMessage(context, MessageType.success,'西域带风湿透黄昏街市');}, child: Text('成功')),
TextButton(onPressed: () {MessageSnackBar.showMessage(context, MessageType.warn,'西域带风湿透黄昏街市');}, child: Text('警告')),
TextButton(onPressed: () {MessageSnackBar.showMessage(context, MessageType.info,'西域带风湿透黄昏街市');}, child: Text('消息')),
TextButton(onPressed: () {MessageSnackBar.showMessage(context, MessageType.error,'西域带风湿透黄昏街市');}, child: Text('错误')),
],
),
Row(
children: [
Text('MessageDialog'),
TextButton(
onPressed: () {
MessageDialog.show(
context, MessageType.warn, "清除所有缓存", '所有将会被充值,请注意此项操作,请务必确定,请注意此项操作,请务必确定请注意此项操作,请务必确定请注意此项操作,请务必确定');
},
child: Text('警告')),
TextButton(
onPressed: () {
MessageDialog.show(
context, MessageType.info, "清除所有缓存", '所有将会被充值,请注意此项操作,请务必确定,请注意此项操作,请务必确定请注意此项操作,请务必确定请注意此项操作,请务必确定');
},
child: Text('消息')),
TextButton(
onPressed: () {
MessageDialog.show(
context, MessageType.error, "清除所有缓存", '所有将会被充值,请注意此项操作,请务必确定,请注意此项操作,请务必确定请注意此项操作,请务必确定请注意此项操作,请务必确定');
},
child: Text('错误')),
],
),
SuccessAnimationWidget()
],
)
],
),
)
);
}
showSwitchHiintDialog(){
SwitchHintDialog switchHintDialog=new SwitchHintDialog(context,
actionkeyText: "actionkeysss",
content: "是否确定提交数据进行条码管理吗试试?", executeCall: (){
print('onConfirm');
});
switchHintDialog.show();
}
showLoadingText(){
//Builder
LoadingDialogText loadingDialogText=new LoadingDialogText(context,title: '全力加载中');
loadingDialogText.show();
}
showIconHintDialog(){
NormalHintDialog iconHintDialog=new NormalHintDialog(context,
confirmTextStyle:new TextStyle(fontSize: 18,decoration: TextDecoration.none,color: Colors.white),
contentTextStyle:new TextStyle(fontSize: 18,decoration: TextDecoration.none),
content: "使用红外扫描条码可以快速接收标本箱");
iconHintDialog.show();
}
showSpinLoading(){
LoadingSpinDialog loadingSpinDialog=new LoadingSpinDialog(context,showBg: false);
loadingSpinDialog.show();
}
showLoading(){
LoadingDialog loadingDialog=new LoadingDialog(context);
loadingDialog.show();
}
pageToTabBar(){
Navigator.of(context).push(new MaterialPageRoute(builder: (buildContext){
return TabTest();
}));
}
pageToDrodown(){
Navigator.of(context).push(new MaterialPageRoute(builder: (buildContext){
return DropDownPage();
}));
}
pageToStepView(){
Navigator.of(context).push(new MaterialPageRoute(builder: (buildContext){
return StepPage();
}));
}
showTips(){
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
margin: EdgeInsets.fromLTRB(12, 0, 12, 24),
behavior: SnackBarBehavior.floating,
backgroundColor: Colors.blue,
content: Container(
child: Row(
children: <Widget>[
Icon(Icons.check_circle,color: Colors.white,),
SizedBox(
width: 12,
),
Text('恭喜你,提交标本箱成功',style: new TextStyle(
fontSize: 14,
color: Colors.white
),)
],
),
),
// action: SnackBarAction(
// label: '知道了',
// onPressed: (){},
// ),
));
}
}