Added enable property to the GradientTouchableContainer, it changes its color when not enabled
This commit is contained in:
parent
73809d9eed
commit
0901688163
2 changed files with 14 additions and 12 deletions
|
|
@ -15,6 +15,12 @@ const kSmallTextStyle = TextStyle(
|
|||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
);
|
||||
const kBlueGradient = LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
stops: [0, 1.0],
|
||||
colors: [Color.fromRGBO(32, 156, 227, 1.0), Color.fromRGBO(45, 83, 216, 1.0)],
|
||||
);
|
||||
|
||||
Color getColorFromPriority(TaskPriority priority) {
|
||||
switch (priority) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../utils.dart';
|
||||
|
||||
class GradientTouchableContainer extends StatelessWidget {
|
||||
/// The border radius of the button.
|
||||
final double radius;
|
||||
|
|
@ -20,6 +22,8 @@ class GradientTouchableContainer extends StatelessWidget {
|
|||
|
||||
final bool isExpanded;
|
||||
|
||||
final bool enabled;
|
||||
|
||||
GradientTouchableContainer({
|
||||
this.radius = 4,
|
||||
@required this.child,
|
||||
|
|
@ -28,6 +32,7 @@ class GradientTouchableContainer extends StatelessWidget {
|
|||
this.onTap,
|
||||
this.shadow,
|
||||
this.isExpanded = false,
|
||||
this.enabled = true,
|
||||
});
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
|
|
@ -40,7 +45,7 @@ class GradientTouchableContainer extends StatelessWidget {
|
|||
return ConstrainedBox(
|
||||
constraints: const BoxConstraints(minWidth: 88.0, minHeight: 36.0),
|
||||
child: GestureDetector(
|
||||
onTap: onTap,
|
||||
onTap: enabled ? onTap : null,
|
||||
child: Container(
|
||||
width: width,
|
||||
height: isExpanded ? null : height,
|
||||
|
|
@ -55,19 +60,10 @@ class GradientTouchableContainer extends StatelessWidget {
|
|||
)
|
||||
: resultChild,
|
||||
decoration: BoxDecoration(
|
||||
color: enabled ? null : Colors.grey,
|
||||
boxShadow: shadow == null ? null : [shadow],
|
||||
borderRadius: BorderRadius.circular(radius),
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
stops: [
|
||||
0,
|
||||
1.0
|
||||
],
|
||||
colors: [
|
||||
Color.fromRGBO(32, 156, 227, 1.0),
|
||||
Color.fromRGBO(45, 83, 216, 1.0)
|
||||
]),
|
||||
gradient: enabled ? kBlueGradient : null,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue