| 1 | import 'package:cake_wallet/generated/i18n.dart'; |
| 2 | import 'package:cake_wallet/src/screens/base_page.dart'; |
| 3 | import 'package:cake_wallet/src/screens/settings/widgets/settings_switcher_cell.dart'; |
| 4 | import 'package:cake_wallet/src/widgets/cake_image_widget.dart'; |
| 5 | import 'package:cake_wallet/view_model/settings/connection_sync_view_model.dart'; |
| 6 | import 'package:flutter/material.dart'; |
| 7 | import 'package:flutter_mobx/flutter_mobx.dart'; |
| 8 | |
| 9 | class DomainLookupsPage extends BasePage { |
| 10 | DomainLookupsPage(this._connectionsSyncViewModel); |
| 11 | |
| 12 | @override |
| 13 | String get title => S.current.domain_looks_up; |
| 14 | |
| 15 | final ConnectionSyncViewModel _connectionsSyncViewModel; |
| 16 | |
| 17 | @override |
| 18 | Widget body(BuildContext context) { |
| 19 | return SingleChildScrollView( |
| 20 | child: Observer(builder: (_) { |
| 21 | return Container( |
| 22 | padding: EdgeInsets.only(top: 10), |
| 23 | child: Column( |
| 24 | children: _connectionsSyncViewModel.domainLookupSources |
| 25 | .map( |
| 26 | (source) => SettingsSwitcherCell( |
| 27 | title: source.label, |
| 28 | leading: source.iconPath.isNotEmpty |
| 29 | ? CakeImageWidget( |
| 30 | imageUrl: source.iconPath, |
| 31 | width: 24, |
| 32 | height: 24, |
| 33 | ) |
| 34 | : SizedBox(width: 24, height: 24), |
| 35 | value: _connectionsSyncViewModel.lookupValue(source), |
| 36 | onValueChange: (_, bool value) => |
| 37 | _connectionsSyncViewModel.setLookupValue(source, value), |
| 38 | ), |
| 39 | ) |
| 40 | .toList(), |
| 41 | ), |
| 42 | ); |
| 43 | }), |
| 44 | ); |
| 45 | } |
| 46 | } |