添加渐变按钮

null_safety
张萌 4 years ago
parent f0efe06eef
commit bd07e09b4a

@ -14,16 +14,16 @@ class _ExampleButtonState extends State<ExampleButton> {
return ASScaffold( return ASScaffold(
title: 'Button', title: 'Button',
body: ListView( body: ListView(
children: [ ASButton.delete(title: '删除订单',onpressed: (){},), children: [ ASButton.delete(title: '删除订单',onPressed: (){},),
ASButton.info(title: '删除订单',onpressed: (){},), ASButton.info(title: '删除订单',onPressed: (){},),
ASButton.warn(title: '删除订单',onpressed: (){},), ASButton.warn(title: '删除订单',onPressed: (){},),
ASButton.opration(title: '删除订单',onpressed: (){},), ASButton.opration(title: '删除订单',onPressed: (){},),
SizedBox(height: 12.w), SizedBox(height: 12.w),
ASLongButton.solid(title: '确认',onpressed: (){},), ASLongButton.solid(title: '确认',onPressed: (){},),
ASLongButton.hollow(title: '确认',onpressed: (){},), ASLongButton.hollow(title: '确认',onPressed: (){},),
Padding( Padding(
padding: EdgeInsets.symmetric(horizontal: 100.w), padding: EdgeInsets.symmetric(horizontal: 100.w),
child: ASLongButton.solid(title: 'null',onpressed:(){} ), child: ASLongButton.solid(title: 'null',onPressed:(){} ),
), ),
], ],
), ),

@ -1,6 +1,5 @@
import 'package:ansu_ui/ansu_ui.dart'; import 'package:ansu_ui/ansu_ui.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart';
class ExampleScaffold extends StatefulWidget { class ExampleScaffold extends StatefulWidget {
ExampleScaffold({Key key}) : super(key: key); ExampleScaffold({Key key}) : super(key: key);

@ -42,8 +42,8 @@ class _MyHomePageState extends State<MyHomePage> {
title: '安速组件', title: '安速组件',
body: ListView( body: ListView(
children: [ children: [
ASButton.info(title:'Button',onpressed: () => Get.to(ExampleButton())), ASButton.info(title:'Button',onPressed: () => Get.to(ExampleButton())),
ASButton.info(title:'Scaffold', onpressed:() => Get.to(ExampleScaffold())), ASButton.info(title:'Scaffold', onPressed:() => Get.to(ExampleScaffold())),
], ],
), ),
); );

@ -30,7 +30,7 @@ class ASButton extends StatefulWidget {
final EdgeInsets padding; final EdgeInsets padding;
/// ///
final VoidCallback onpressed; final VoidCallback onPressed;
/// ///
final double width; final double width;
@ -44,7 +44,7 @@ class ASButton extends StatefulWidget {
this.textStyle, this.textStyle,
this.padding, this.padding,
@required this.title, @required this.title,
this.onpressed, this.onPressed,
this.width, this.width,
}) : super(key: key); }) : super(key: key);
@ -54,7 +54,7 @@ class ASButton extends StatefulWidget {
this.padding, this.padding,
this.radius, this.radius,
this.bgcolor, this.bgcolor,
this.onpressed, this.onPressed,
@required this.title, @required this.title,
this.width}) this.width})
: outline = true, : outline = true,
@ -69,7 +69,7 @@ class ASButton extends StatefulWidget {
this.textStyle, this.textStyle,
this.padding, this.padding,
@required this.title, @required this.title,
this.onpressed, this.onPressed,
this.width}) this.width})
: outline = true, : outline = true,
outlineColor = Color(0x73000000), outlineColor = Color(0x73000000),
@ -83,7 +83,7 @@ class ASButton extends StatefulWidget {
this.textStyle, this.textStyle,
this.padding, this.padding,
@required this.title, @required this.title,
this.onpressed, this.onPressed,
this.width}) this.width})
: bgcolor = Color(0xFFFFB600), : bgcolor = Color(0xFFFFB600),
textColor = Color(0xD9FFFFFF), textColor = Color(0xD9FFFFFF),
@ -96,7 +96,7 @@ class ASButton extends StatefulWidget {
this.textStyle, this.textStyle,
this.padding, this.padding,
@required this.title, @required this.title,
this.onpressed, this.onPressed,
this.width}) this.width})
: bgcolor = Color(0xFFF2F2F2), : bgcolor = Color(0xFFF2F2F2),
textColor = Color(0xD9000000), textColor = Color(0xD9000000),
@ -113,7 +113,7 @@ class _ASButtonState extends State<ASButton> {
return MaterialButton( return MaterialButton(
minWidth: widget.width ?? 75.w, minWidth: widget.width ?? 75.w,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
onPressed: widget.onpressed, onPressed: widget.onPressed,
child: widget.title is String child: widget.title is String
? Text(widget.title, ? Text(widget.title,
style: widget.textStyle ?? style: widget.textStyle ??

@ -29,7 +29,7 @@ class ASLongButton extends StatefulWidget {
final Color outlineColor; final Color outlineColor;
/// ///
final VoidCallback onpressed; final VoidCallback onPressed;
/// ///
final double width; final double width;
@ -44,7 +44,7 @@ class ASLongButton extends StatefulWidget {
this.padding, this.padding,
this.outline = false, this.outline = false,
this.outlineColor, this.outlineColor,
this.onpressed, this.onPressed,
this.width}) this.width})
: super(key: key); : super(key: key);
@ -55,7 +55,7 @@ class ASLongButton extends StatefulWidget {
this.outlineColor, this.outlineColor,
this.radius, this.radius,
@required this.title, @required this.title,
this.onpressed, this.onPressed,
this.width, this.width,
}) : bgColor = Color(0xFFF6B72D), }) : bgColor = Color(0xFFF6B72D),
textColor = Color(0xFFFFFFFF), textColor = Color(0xFFFFFFFF),
@ -66,7 +66,7 @@ class ASLongButton extends StatefulWidget {
this.radius, this.radius,
this.textStyle, this.textStyle,
this.padding, this.padding,
this.onpressed, this.onPressed,
@required this.title, @required this.title,
this.width}) this.width})
: bgColor = Color(0xFFFFFFFF), : bgColor = Color(0xFFFFFFFF),
@ -85,7 +85,7 @@ class _ASLongButtonState extends State<ASLongButton> {
minWidth: widget.width ?? 280.w, minWidth: widget.width ?? 280.w,
disabledColor: Color(0xFFC1BDB5), disabledColor: Color(0xFFC1BDB5),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
onPressed: widget.onpressed, onPressed: widget.onPressed,
child: widget.title is String child: widget.title is String
? Text(widget.title, ? Text(widget.title,
style: widget.textStyle ?? style: widget.textStyle ??

Loading…
Cancel
Save