dev
dart 52 lines 1.77 KB
Raw
1 import 'package:cake_wallet/generated/i18n.dart';
2 import 'package:cake_wallet/utils/responsive_layout_util.dart';
3 import 'package:dotted_border/dotted_border.dart';
4 import 'package:flutter/material.dart';
5
6 class AddTemplateButton extends StatelessWidget {
7 final Function() onTap;
8 final int currentTemplatesLength;
9
10 const AddTemplateButton({Key? key, required this.onTap, required this.currentTemplatesLength})
11 : super(key: key);
12
13 @override
14 Widget build(BuildContext context) {
15 return GestureDetector(
16 onTap: onTap,
17 child: Container(
18 padding: EdgeInsets.only(left: 1, right: 10),
19 child: DottedBorder(
20 borderType: BorderType.RRect,
21 dashPattern: [6, 4],
22 color: Theme.of(context).colorScheme.outline,
23 strokeWidth: 2,
24 radius: Radius.circular(12),
25 child: Container(
26 height: 34,
27 padding: EdgeInsets.symmetric(
28 horizontal: responsiveLayoutUtil.shouldRenderMobileUI ? 10 : 30,
29 ),
30 alignment: Alignment.center,
31 decoration: BoxDecoration(
32 borderRadius: BorderRadius.all(Radius.circular(12)),
33 color: Colors.transparent,
34 ),
35 child: currentTemplatesLength >= 1
36 ? Icon(
37 Icons.add,
38 color: Theme.of(context).colorScheme.onSurfaceVariant,
39 )
40 : Text(
41 S.of(context).new_template,
42 style: Theme.of(context).textTheme.bodyMedium?.copyWith(
43 fontWeight: FontWeight.w600,
44 color: Theme.of(context).colorScheme.onSurfaceVariant,
45 ),
46 ),
47 ),
48 ),
49 ),
50 );
51 }
52 }