dev
dart 88 lines 3.28 KB
Raw
1 import 'package:cake_wallet/generated/i18n.dart';
2 import 'package:cake_wallet/routes.dart';
3 import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
4 import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
5 import 'package:flutter/material.dart';
6 import 'package:flutter_mobx/flutter_mobx.dart';
7 import 'package:flutter_svg/flutter_svg.dart';
8
9 class MwebAd extends StatelessWidget {
10 const MwebAd({super.key, required this.dashboardViewModel});
11
12 final DashboardViewModel dashboardViewModel;
13
14 @override
15 Widget build(BuildContext context) {
16 return Observer(builder: (_) {
17 if (!dashboardViewModel.shouldShowMwebAd) return SizedBox.shrink();
18
19 return Padding(
20 padding: const EdgeInsets.only(left: 16, right: 16, bottom: 12, top: 24),
21 child: Column(
22 spacing: 12,
23 children: [
24 MergeSemantics(
25 child: Semantics(
26 button: true,
27 child: GestureDetector(
28 onTap: () => Navigator.of(context).pushNamed(Routes.mwebSettings),
29 child: Container(
30 height: 64,
31 decoration: BoxDecoration(
32 borderRadius: BorderRadius.circular(18),
33 color: Theme.of(context).colorScheme.surfaceContainer),
34 child: Padding(
35 padding: const EdgeInsets.symmetric(horizontal: 12.0),
36 child: Row(
37 mainAxisAlignment: MainAxisAlignment.spaceBetween,
38 children: [
39 ExcludeSemantics(
40 child: CakeImageWidget(
41 imageUrl: "assets/new-ui/settings_row_icons/mweb.svg",
42 width: 24,
43 height: 24,
44 ),
45 ),
46 Expanded(
47 child: Padding(
48 padding: const EdgeInsets.symmetric(horizontal: 12.0),
49 child: Text(
50 S.of(context).mweb_ad,
51 softWrap: true,
52 style: TextStyle(fontSize: 12),
53 ),
54 ),
55 ),
56 Icon(
57 size: 16,
58 Icons.arrow_forward_ios,
59 color: Theme.of(context).colorScheme.primary,
60 )
61 ],
62 ),
63 ),
64 ),
65 ),
66 ),
67 ),
68 MergeSemantics(
69 child: Semantics(
70 button: true,
71 child: GestureDetector(
72 onTap: () => dashboardViewModel.dismissMwebAd(false),
73 child: Text(
74 S.of(context).do_not_show_anymore,
75 style: TextStyle(
76 fontSize: 12,
77 fontWeight: FontWeight.w500,
78 color: Theme.of(context).colorScheme.primary),
79 ),
80 ),
81 ),
82 )
83 ],
84 ),
85 );
86 });
87 }
88 }