1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- import 'package:flutter/material.dart';
- import 'package:flutter/cupertino.dart';
- import 'package:cool_ui/cool_ui.dart';
- class WeuiToastDemo extends StatefulWidget{
- @override
- State<StatefulWidget> createState() {
- // TODO: implement createState
- return WeuiToastDemoState();
- }
- }
- class WeuiToastDemoState extends State<WeuiToastDemo>{
- bool isPaintBackgroud = false;
- @override
- Widget build(BuildContext context) {
- // TODO: implement build
- return Scaffold(
- appBar: AppBar(
- title: Text("WeuiToast Demo"),
- ),
- body: ListView(
- padding: const EdgeInsets.symmetric(vertical: 24.0, horizontal: 72.0),
- children: <Widget>[
- RaisedButton(
- color: Colors.blue[400],
- child: Text("成功",style: TextStyle(color: Colors.white),),
- onPressed: ()=>showWeuiSuccessToast(context:context,message: Text("成功啦!")),
- ),
- RaisedButton(
- color: Colors.blue[400],
- child: Text("加载中",style: TextStyle(color: Colors.white),),
- onPressed: (){
- var hide = showWeuiLoadingToast(context:context, message:Text("加载中"));
- Future.delayed(Duration(seconds: 5),(){
- hide();
- });
- },
- ),
- ].map((Widget button) {
- return Container(
- padding: const EdgeInsets.symmetric(vertical: 8.0),
- child: button
- );
- })
- .toList(),
- )
- );
- }
- }
|