From 89028500e7c83b66551c65914faf733f142c04e0 Mon Sep 17 00:00:00 2001 From: Serhii Date: Fri, 23 Dec 2022 23:58:39 +0200 Subject: [PATCH] extract SectionDivider widget --- .../screens/dashboard/widgets/filter_widget.dart | 13 +------------ .../monero_account_list_page.dart | 7 ++----- lib/src/screens/receive/receive_page.dart | 4 ++-- .../send/widgets/choose_yat_address_alert.dart | 6 ++---- .../screens/wallet_keys/wallet_keys_page.dart | 6 ++---- lib/src/widgets/base_alert_dialog.dart | 16 ++++------------ lib/src/widgets/section_divider.dart | 13 +++++++++++++ 7 files changed, 26 insertions(+), 39 deletions(-) create mode 100644 lib/src/widgets/section_divider.dart diff --git a/lib/src/screens/dashboard/widgets/filter_widget.dart b/lib/src/screens/dashboard/widgets/filter_widget.dart index 6831819e4..dd693777b 100644 --- a/lib/src/screens/dashboard/widgets/filter_widget.dart +++ b/lib/src/screens/dashboard/widgets/filter_widget.dart @@ -1,6 +1,7 @@ import 'dart:ui'; import 'package:cake_wallet/palette.dart'; import 'package:cake_wallet/src/screens/dashboard/widgets/filter_tile.dart'; +import 'package:cake_wallet/src/widgets/section_divider.dart'; import 'package:cake_wallet/src/widgets/standard_checkbox.dart'; import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart'; import 'package:flutter/cupertino.dart'; @@ -141,15 +142,3 @@ class FilterWidget extends StatelessWidget { ); } } - -class SectionDivider extends StatelessWidget { - const SectionDivider(); - - @override - Widget build(BuildContext context) { - return Container( - height: 1, - color: Theme.of(context).dividerColor, - ); - } -} diff --git a/lib/src/screens/monero_accounts/monero_account_list_page.dart b/lib/src/screens/monero_accounts/monero_account_list_page.dart index 99134369e..c565332a0 100644 --- a/lib/src/screens/monero_accounts/monero_account_list_page.dart +++ b/lib/src/screens/monero_accounts/monero_account_list_page.dart @@ -1,4 +1,5 @@ import 'dart:ui'; +import 'package:cake_wallet/src/widgets/section_divider.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; @@ -83,11 +84,7 @@ class MoneroAccountListPage extends StatelessWidget { ListView.separated( padding: EdgeInsets.zero, controller: controller, - separatorBuilder: (context, index) => - Container( - height: 1, - color: Theme.of(context).dividerColor, - ), + separatorBuilder: (context, index) => SectionDivider(), itemCount: accounts.length ?? 0, itemBuilder: (context, index) { final account = accounts[index]; diff --git a/lib/src/screens/receive/receive_page.dart b/lib/src/screens/receive/receive_page.dart index 6f6b4e31c..4344139ac 100644 --- a/lib/src/screens/receive/receive_page.dart +++ b/lib/src/screens/receive/receive_page.dart @@ -1,4 +1,5 @@ import 'package:cake_wallet/src/widgets/keyboard_done_button.dart'; +import 'package:cake_wallet/src/widgets/section_divider.dart'; import 'package:cake_wallet/themes/theme_base.dart'; import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart'; @@ -135,8 +136,7 @@ class ReceivePage extends BasePage { Observer( builder: (_) => ListView.separated( padding: EdgeInsets.all(0), - separatorBuilder: (context, _) => Container( - height: 1, color: Theme.of(context).dividerColor), + separatorBuilder: (context, _) => SectionDivider(), shrinkWrap: true, physics: NeverScrollableScrollPhysics(), itemCount: addressListViewModel.items.length, diff --git a/lib/src/screens/send/widgets/choose_yat_address_alert.dart b/lib/src/screens/send/widgets/choose_yat_address_alert.dart index 93785743d..dae6c5ad7 100644 --- a/lib/src/screens/send/widgets/choose_yat_address_alert.dart +++ b/lib/src/screens/send/widgets/choose_yat_address_alert.dart @@ -1,4 +1,5 @@ import 'package:cake_wallet/src/widgets/cake_scrollbar.dart'; +import 'package:cake_wallet/src/widgets/section_divider.dart'; import 'package:flutter/material.dart'; import 'package:cake_wallet/src/widgets/base_alert_dialog.dart'; @@ -70,10 +71,7 @@ class ChooseYatAddressButtonsState extends State { controller: controller, padding: EdgeInsets.all(0), itemCount: itemCount, - separatorBuilder: (_, __) => Container( - height: 1, - color: Theme.of(context).dividerColor, - ), + separatorBuilder: (_, __) => SectionDivider(), itemBuilder: (context, index) { final address = addresses[index]; diff --git a/lib/src/screens/wallet_keys/wallet_keys_page.dart b/lib/src/screens/wallet_keys/wallet_keys_page.dart index f97200e1e..b690cadda 100644 --- a/lib/src/screens/wallet_keys/wallet_keys_page.dart +++ b/lib/src/screens/wallet_keys/wallet_keys_page.dart @@ -1,4 +1,5 @@ import 'package:auto_size_text/auto_size_text.dart'; +import 'package:cake_wallet/src/widgets/section_divider.dart'; import 'package:cake_wallet/utils/show_bar.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; @@ -57,10 +58,7 @@ class WalletKeysPage extends BasePage { height: 1, padding: EdgeInsets.only(left: 24), color: Theme.of(context).accentTextTheme!.headline6!.backgroundColor!, - child: Container( - height: 1, - color: Theme.of(context).dividerColor, - ), + child: SectionDivider(), ), itemCount: walletKeysViewModel.items.length, itemBuilder: (BuildContext context, int index) { diff --git a/lib/src/widgets/base_alert_dialog.dart b/lib/src/widgets/base_alert_dialog.dart index 70370e227..861d1ba9d 100644 --- a/lib/src/widgets/base_alert_dialog.dart +++ b/lib/src/widgets/base_alert_dialog.dart @@ -1,4 +1,5 @@ import 'dart:ui'; +import 'package:cake_wallet/src/widgets/section_divider.dart'; import 'package:flutter/material.dart'; import 'package:cake_wallet/palette.dart'; @@ -76,10 +77,7 @@ class BaseAlertDialog extends StatelessWidget { ), )), ), - Container( - width: 1, - color: Theme.of(context).dividerColor, - ), + SectionDivider(), Expanded( child: TextButton( onPressed: actionRight, @@ -140,10 +138,7 @@ class BaseAlertDialog extends StatelessWidget { isDividerExists ? Padding( padding: EdgeInsets.only(top: 16, bottom: 8), - child: Container( - height: 1, - color: Theme.of(context).dividerColor, - ), + child: SectionDivider(), ) : Offstage(), Padding( @@ -152,10 +147,7 @@ class BaseAlertDialog extends StatelessWidget { ) ], ), - Container( - height: 1, - color: Theme.of(context).dividerColor, - ), + SectionDivider(), actionButtons(context) ], ), diff --git a/lib/src/widgets/section_divider.dart b/lib/src/widgets/section_divider.dart new file mode 100644 index 000000000..bef85f975 --- /dev/null +++ b/lib/src/widgets/section_divider.dart @@ -0,0 +1,13 @@ +import 'package:flutter/material.dart'; + +class SectionDivider extends StatelessWidget { + const SectionDivider(); + + @override + Widget build(BuildContext context) { + return Container( + height: 1, + color: Theme.of(context).dividerColor, + ); + } +} \ No newline at end of file