You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansu_ui/example/lib/widgets/example_button.dart

179 lines
4.8 KiB

// BEGIN button
4 years ago
import 'package:ansu_ui/ansu_ui.dart';
import 'package:example/codeviewer/code_segments.dart';
import 'package:example/common/code_view.dart';
4 years ago
import 'package:flutter/material.dart';
4 years ago
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
4 years ago
class ExampleButton extends StatefulWidget {
ExampleButton({Key key}) : super(key: key);
@override
_ExampleButtonState createState() => _ExampleButtonState();
}
class _ExampleButtonState extends State<ExampleButton> {
int groupValue = 0;
4 years ago
@override
Widget build(BuildContext context) {
return ASScaffold(
4 years ago
title: 'ASButton',
actions: [
IconButton(
icon: Icon(Icons.code, color: Colors.black54),
onPressed: () => Get.to(CodeView(
text: (context) => CodeSegments.button(context),
)),
),
],
4 years ago
body: ListView(
children: [
ListTile(
title: Text('danger'),
trailing: ASButton.danger(
title: '删除订单',
onPressed: () {},
),
),
ListTile(
title: Text('info'),
trailing: ASButton.info(
title: '删除订单',
onPressed: () {},
),
4 years ago
),
ListTile(
title: Text('warn'),
trailing: ASButton.warn(
title: '删除订单',
onPressed: () {},
),
),
ListTile(
title: Text('operation'),
trailing: ASButton.operation(
title: '删除订单',
onPressed: () {},
),
),
ListTile(
title: Text('order'),
trailing: ASButton.order(
4 years ago
title: '立即下单',
onPressed: () {},
)),
ListTile(
title: Text('order'),
subtitle: Text('null function'),
trailing: ASButton.order(
title: '立即下单',
)),
4 years ago
SizedBox(height: 12.w),
4 years ago
Row(
children: [
Spacer(),
Text(
'ASLongButton',
style: TextStyle(fontSize: 20.sp, fontWeight: FontWeight.bold),
),
Spacer(),
],
),
4 years ago
SizedBox(
height: 12.w,
),
ListTile(
title: Text('solid'),
trailing: ASLongButton.solid(
title: '确认',
onPressed: () {},
),
4 years ago
),
ListTile(
title: Text('hollow'),
trailing: ASLongButton.hollow(
title: '确认',
onPressed: () {},
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 100.w),
child: ASLongButton.solid(title: 'adaptable', onPressed: () {}),
4 years ago
),
SizedBox(
height: 12.w,
),
4 years ago
Row(
children: [
4 years ago
Spacer(),
Text(
'ASGradientButton',
style: TextStyle(fontSize: 20.sp, fontWeight: FontWeight.bold),
),
Spacer(),
],
),
SizedBox(
height: 12.w,
),
ListTile(
title: Text('pay'),
trailing: ASGradientButton.pay(
title: '支付',
onPressed: () {},
),
4 years ago
),
ListTile(
title: Text('pay'),
trailing: ASGradientButton.pay(
title: '支付',
onPressed: null,
),
),
ListTile(
title: Text('opration'),
trailing: ASGradientButton.operation(
title: '自动拆票',
onPressed: () {},
),
4 years ago
),
ListTile(
title: Text('Radio Button'),
),
Wrap(
children: [
ASRadioButton(
groupValue: groupValue,
value: 0,
title: '候选0',
onTap: (_) => setState(() => groupValue = 0),
),
ASRadioButton(
groupValue: groupValue,
value: 1,
title: '候选1',
onTap: (_) => setState(() => groupValue = 1),
),
ASRadioButton(
groupValue: groupValue,
value: 2,
title: '候选2',
onTap: (_) => setState(() => groupValue = 2),
),
ASRadioButton(
groupValue: groupValue,
value: 3,
title: '候选3',
onTap: (_) => setState(() => groupValue = 3),
),
],
),
4 years ago
],
),
);
}
}
// END