dev
dart 89 lines 2.73 KB
Raw
1 import 'package:flutter/material.dart';
2
3 class SettingActionButton extends StatelessWidget {
4 final bool isLastTile;
5 final bool isSelected;
6 final bool isArrowVisible;
7 final bool selectionActive;
8 final VoidCallback onTap;
9 final String image;
10 final String title;
11 final double fromBottomEdge;
12 final double fromTopEdge;
13 final double tileHeight;
14 const SettingActionButton({
15 super.key,
16 this.isLastTile = false,
17 this.isSelected = false,
18 this.selectionActive = true,
19 this.isArrowVisible = false,
20 required this.onTap,
21 required this.image,
22 required this.title,
23 this.tileHeight = 60,
24 this.fromTopEdge = 50,
25 this.fromBottomEdge = 25,
26 });
27
28 @override
29 Widget build(BuildContext context) {
30 Color? color = isSelected
31 ? Theme.of(context).colorScheme.primary
32 : selectionActive
33 ? Theme.of(context).colorScheme.primary
34 : Theme.of(context).colorScheme.onSurface;
35 return Container(
36 //padding: EdgeInsets.only(top: 5, left: 15, bottom: 5),
37 margin: EdgeInsets.only(top: 10, left: 20, bottom: 0, right: 20),
38 child: TextButton(
39 style: ButtonStyle(
40 backgroundColor: WidgetStateProperty.all(
41 Theme.of(context).colorScheme.surfaceContainer,
42 ),
43 shape: WidgetStateProperty.all(
44 RoundedRectangleBorder(
45 borderRadius: BorderRadius.circular(18),
46 ),
47 ),
48 ),
49 onPressed: onTap,
50 //hoverColor: Colors.transparent,
51 child: Container(
52 width: double.infinity,
53 padding: EdgeInsets.only(top: 12, left: 20, bottom: 12, right: 15),
54 //margin: EdgeInsets.only(top: 5, left: 15, bottom: 5),
55 alignment: isLastTile ? Alignment.topLeft : null,
56 child: Row(
57 mainAxisAlignment: MainAxisAlignment.start,
58 crossAxisAlignment: CrossAxisAlignment.center,
59 children: <Widget>[
60 Image.asset(
61 image,
62 height: 16,
63 width: 16,
64 color: Theme.of(context).colorScheme.primary,
65 ),
66 SizedBox(width: 16),
67 Expanded(
68 child: Text(
69 title,
70 style: Theme.of(context).textTheme.bodyMedium?.copyWith(
71 color: color,
72 fontSize: 16,
73 fontWeight: FontWeight.w800,
74 ),
75 ),
76 ),
77 if (isArrowVisible)
78 Icon(
79 Icons.arrow_forward_ios,
80 color: Theme.of(context).colorScheme.primary,
81 size: 16,
82 )
83 ],
84 ),
85 ),
86 ),
87 );
88 }
89 }