extract SectionDivider widget

This commit is contained in:
Serhii 2022-12-23 23:58:39 +02:00
parent 00c008ed8b
commit 89028500e7
7 changed files with 26 additions and 39 deletions

View file

@ -1,6 +1,7 @@
import 'dart:ui'; import 'dart:ui';
import 'package:cake_wallet/palette.dart'; import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/src/screens/dashboard/widgets/filter_tile.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/src/widgets/standard_checkbox.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart'; import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:flutter/cupertino.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,
);
}
}

View file

@ -1,4 +1,5 @@
import 'dart:ui'; import 'dart:ui';
import 'package:cake_wallet/src/widgets/section_divider.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:flutter_mobx/flutter_mobx.dart';
@ -83,11 +84,7 @@ class MoneroAccountListPage extends StatelessWidget {
ListView.separated( ListView.separated(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
controller: controller, controller: controller,
separatorBuilder: (context, index) => separatorBuilder: (context, index) => SectionDivider(),
Container(
height: 1,
color: Theme.of(context).dividerColor,
),
itemCount: accounts.length ?? 0, itemCount: accounts.length ?? 0,
itemBuilder: (context, index) { itemBuilder: (context, index) {
final account = accounts[index]; final account = accounts[index];

View file

@ -1,4 +1,5 @@
import 'package:cake_wallet/src/widgets/keyboard_done_button.dart'; 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/themes/theme_base.dart';
import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart'; import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
@ -135,8 +136,7 @@ class ReceivePage extends BasePage {
Observer( Observer(
builder: (_) => ListView.separated( builder: (_) => ListView.separated(
padding: EdgeInsets.all(0), padding: EdgeInsets.all(0),
separatorBuilder: (context, _) => Container( separatorBuilder: (context, _) => SectionDivider(),
height: 1, color: Theme.of(context).dividerColor),
shrinkWrap: true, shrinkWrap: true,
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
itemCount: addressListViewModel.items.length, itemCount: addressListViewModel.items.length,

View file

@ -1,4 +1,5 @@
import 'package:cake_wallet/src/widgets/cake_scrollbar.dart'; 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:flutter/material.dart';
import 'package:cake_wallet/src/widgets/base_alert_dialog.dart'; import 'package:cake_wallet/src/widgets/base_alert_dialog.dart';
@ -70,10 +71,7 @@ class ChooseYatAddressButtonsState extends State<ChooseYatAddressButtons> {
controller: controller, controller: controller,
padding: EdgeInsets.all(0), padding: EdgeInsets.all(0),
itemCount: itemCount, itemCount: itemCount,
separatorBuilder: (_, __) => Container( separatorBuilder: (_, __) => SectionDivider(),
height: 1,
color: Theme.of(context).dividerColor,
),
itemBuilder: (context, index) { itemBuilder: (context, index) {
final address = addresses[index]; final address = addresses[index];

View file

@ -1,4 +1,5 @@
import 'package:auto_size_text/auto_size_text.dart'; 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:cake_wallet/utils/show_bar.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -57,10 +58,7 @@ class WalletKeysPage extends BasePage {
height: 1, height: 1,
padding: EdgeInsets.only(left: 24), padding: EdgeInsets.only(left: 24),
color: Theme.of(context).accentTextTheme!.headline6!.backgroundColor!, color: Theme.of(context).accentTextTheme!.headline6!.backgroundColor!,
child: Container( child: SectionDivider(),
height: 1,
color: Theme.of(context).dividerColor,
),
), ),
itemCount: walletKeysViewModel.items.length, itemCount: walletKeysViewModel.items.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {

View file

@ -1,4 +1,5 @@
import 'dart:ui'; import 'dart:ui';
import 'package:cake_wallet/src/widgets/section_divider.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart'; import 'package:cake_wallet/palette.dart';
@ -76,10 +77,7 @@ class BaseAlertDialog extends StatelessWidget {
), ),
)), )),
), ),
Container( SectionDivider(),
width: 1,
color: Theme.of(context).dividerColor,
),
Expanded( Expanded(
child: TextButton( child: TextButton(
onPressed: actionRight, onPressed: actionRight,
@ -140,10 +138,7 @@ class BaseAlertDialog extends StatelessWidget {
isDividerExists isDividerExists
? Padding( ? Padding(
padding: EdgeInsets.only(top: 16, bottom: 8), padding: EdgeInsets.only(top: 16, bottom: 8),
child: Container( child: SectionDivider(),
height: 1,
color: Theme.of(context).dividerColor,
),
) )
: Offstage(), : Offstage(),
Padding( Padding(
@ -152,10 +147,7 @@ class BaseAlertDialog extends StatelessWidget {
) )
], ],
), ),
Container( SectionDivider(),
height: 1,
color: Theme.of(context).dividerColor,
),
actionButtons(context) actionButtons(context)
], ],
), ),

View file

@ -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,
);
}
}