51 lines
1.7 KiB
Dart
51 lines
1.7 KiB
Dart
import 'package:cherry_toast/cherry_toast.dart';
|
|
import 'package:cherry_toast/resources/arrays.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class ButtonWidgetsLess extends StatelessWidget{
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(title: Text("按钮控件"),),
|
|
body: ButtonWidgets(),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ButtonWidgets extends StatefulWidget {
|
|
@override
|
|
State<StatefulWidget> createState() {
|
|
return ButtonWidgetsState();
|
|
}
|
|
}
|
|
|
|
class ButtonWidgetsState extends State<ButtonWidgets> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
children: [
|
|
// ElevatedButton样式
|
|
ElevatedButton(
|
|
onPressed: () =>
|
|
CherryToast(icon: Icons.info, themeColor: Colors.blue, title: Text("ElevatedButton"),).show(context),
|
|
child: Text("ElevatedButton")
|
|
),
|
|
TextButton(
|
|
onPressed: () => CherryToast.info(title: Text("TextButton"), toastPosition: Position.bottom,).show(context),
|
|
child: Text("TextButton")),
|
|
OutlinedButton(
|
|
onPressed: () => CherryToast.info(title: Text("你点击了OutlineButton")).show(context),
|
|
child: Text("OutlineButton")),
|
|
IconButton(
|
|
onPressed: () => CherryToast.info(title: Text("您点击了IconButton")).show(context),
|
|
icon: Icon(Icons.account_circle)
|
|
),
|
|
ElevatedButton.icon(
|
|
onPressed: () => CherryToast.info(title: Text("您点击了带图标的ElevatedButton"),).show(context),
|
|
icon: Icon(Icons.accessibility_new_sharp),
|
|
label: Text("带图标的ElevatedButton"))
|
|
],
|
|
);
|
|
}
|
|
|
|
} |