|
|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
import 'package:driverapp/config/config.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:hexcolor/hexcolor.dart';
|
|
|
|
|
|
|
|
|
|
@ -13,19 +14,18 @@ import 'package:hexcolor/hexcolor.dart';
|
|
|
|
|
/// [borderColor] the button border color
|
|
|
|
|
/// [noBorderRadius] remove border radius
|
|
|
|
|
class SecondaryButton extends StatefulWidget {
|
|
|
|
|
SecondaryButton(
|
|
|
|
|
{Key key,
|
|
|
|
|
this.label = "",
|
|
|
|
|
this.icon,
|
|
|
|
|
this.iconOnly = false,
|
|
|
|
|
this.color,
|
|
|
|
|
this.textColor,
|
|
|
|
|
this.onTap,
|
|
|
|
|
this.loading: false,
|
|
|
|
|
this.small = false,
|
|
|
|
|
this.disabled = false,
|
|
|
|
|
this.borderColor,
|
|
|
|
|
this.noBorderRadius = false})
|
|
|
|
|
SecondaryButton({Key key,
|
|
|
|
|
this.label = "",
|
|
|
|
|
this.icon,
|
|
|
|
|
this.iconOnly = false,
|
|
|
|
|
this.color,
|
|
|
|
|
this.textColor,
|
|
|
|
|
this.onTap,
|
|
|
|
|
this.loading: false,
|
|
|
|
|
this.small = false,
|
|
|
|
|
this.disabled = false,
|
|
|
|
|
this.borderColor,
|
|
|
|
|
this.noBorderRadius = false})
|
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
|
|
final String label;
|
|
|
|
|
@ -148,7 +148,7 @@ class _SecondaryButtonState extends State<SecondaryButton>
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
border: widget.borderColor != null
|
|
|
|
|
? Border.all(
|
|
|
|
|
color: widget.borderColor.withOpacity(0.1), width: 2.0)
|
|
|
|
|
color: widget.borderColor.withOpacity(0.1), width: 2.0)
|
|
|
|
|
: null,
|
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(100.0)),
|
|
|
|
|
boxShadow: [
|
|
|
|
|
@ -191,14 +191,8 @@ class _SecondaryButtonState extends State<SecondaryButton>
|
|
|
|
|
height: MediaQuery.of(context).size.width * 2.2,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
gradient: widget.color != null
|
|
|
|
|
? null
|
|
|
|
|
: LinearGradient(
|
|
|
|
|
colors: [
|
|
|
|
|
Hexcolor("#45B7AE"),
|
|
|
|
|
Hexcolor("#119FA9")
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
gradient:
|
|
|
|
|
widget.color != null ? null : LINEAR_GRADIENT,
|
|
|
|
|
color: widget.color != null
|
|
|
|
|
? widget.color
|
|
|
|
|
: Hexcolor("#000000"),
|
|
|
|
|
@ -226,29 +220,29 @@ class _SecondaryButtonState extends State<SecondaryButton>
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
widget.loading
|
|
|
|
|
? Padding(
|
|
|
|
|
padding: EdgeInsets.all(2.6),
|
|
|
|
|
child: SizedBox(
|
|
|
|
|
height: 19.0,
|
|
|
|
|
width: 19.0,
|
|
|
|
|
child: CircularProgressIndicator(
|
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
|
valueColor: AlwaysStoppedAnimation<Color>(
|
|
|
|
|
Colors.grey[300],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
padding: EdgeInsets.all(2.6),
|
|
|
|
|
child: SizedBox(
|
|
|
|
|
height: 19.0,
|
|
|
|
|
width: 19.0,
|
|
|
|
|
child: CircularProgressIndicator(
|
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
|
valueColor: AlwaysStoppedAnimation<Color>(
|
|
|
|
|
Colors.grey[300],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: Padding(
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
bottom: widget.small ? 4.0 : 2.0),
|
|
|
|
|
child: Text(widget.label,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: widget.textColor != null
|
|
|
|
|
? widget.textColor
|
|
|
|
|
: Colors.white,
|
|
|
|
|
fontSize: 17.0,
|
|
|
|
|
fontFamily: "WorkSans")),
|
|
|
|
|
)
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
bottom: widget.small ? 4.0 : 2.0),
|
|
|
|
|
child: Text(widget.label,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: widget.textColor != null
|
|
|
|
|
? widget.textColor
|
|
|
|
|
: Colors.white,
|
|
|
|
|
fontSize: 17.0,
|
|
|
|
|
fontFamily: "WorkSans")),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
|