app working with sandbox
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
/// Settings tab: theme mode, data source, and about information.
|
||||
/// Settings tab: theme mode, API endpoint, and bank link status.
|
||||
library;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../providers/item_provider.dart';
|
||||
import '../providers/bank_provider.dart';
|
||||
import '../providers/theme_provider.dart';
|
||||
import '../utils/connect_bank.dart';
|
||||
import '../utils/constants.dart';
|
||||
import '../utils/helpers.dart';
|
||||
import '../widgets/responsive_body.dart';
|
||||
@@ -16,7 +17,7 @@ class SettingsScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final themeController = context.watch<ThemeController>();
|
||||
final items = context.watch<ItemController>();
|
||||
final bank = context.watch<BankController>();
|
||||
final theme = Theme.of(context);
|
||||
|
||||
return Scaffold(
|
||||
@@ -56,19 +57,58 @@ class SettingsScreen extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 28),
|
||||
Text('Data', style: theme.textTheme.titleMedium),
|
||||
Text('Backend', style: theme.textTheme.titleMedium),
|
||||
const SizedBox(height: 8),
|
||||
Card(
|
||||
child: SwitchListTile(
|
||||
title: const Text('Use remote sample API'),
|
||||
subtitle: const Text(
|
||||
'When on, items are fetched with the http package from '
|
||||
'JSONPlaceholder. Failures fall back to local mock data.',
|
||||
),
|
||||
value: items.useRemoteData,
|
||||
onChanged: (value) => items.setUseRemoteData(value),
|
||||
child: Column(
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.dns_outlined),
|
||||
title: const Text('API base URL'),
|
||||
subtitle: Text(bank.apiBaseUrl),
|
||||
),
|
||||
const Divider(height: 1),
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
bank.isLinked
|
||||
? Icons.link
|
||||
: Icons.link_off_outlined,
|
||||
),
|
||||
title: const Text('Bank link'),
|
||||
subtitle: Text(
|
||||
bank.isLinked
|
||||
? 'Linked · ${bank.status.status}'
|
||||
: 'Not linked',
|
||||
),
|
||||
trailing: bank.isLinked
|
||||
? null
|
||||
: TextButton(
|
||||
onPressed: bank.isConnecting
|
||||
? null
|
||||
: () => runConnectBank(context, bank),
|
||||
child: Text(
|
||||
bank.isConnecting ? 'Opening…' : 'Connect',
|
||||
),
|
||||
),
|
||||
),
|
||||
const Divider(height: 1),
|
||||
const ListTile(
|
||||
leading: Icon(Icons.open_in_browser_outlined),
|
||||
title: Text('Enable Banking redirect'),
|
||||
subtitle: Text(kEnableBankingRedirectUri),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
'Enable Banking only allows http(s) redirects. Keep '
|
||||
'$kEnableBankingRedirectUri in the Control Panel and backend '
|
||||
'REDIRECT_URI. The app captures that URL inside a WebView. '
|
||||
'Override the API host with '
|
||||
'`--dart-define=API_BASE_URL=http://<host>:8000`.',
|
||||
style: theme.textTheme.bodyMedium,
|
||||
),
|
||||
const SizedBox(height: 28),
|
||||
Text('About', style: theme.textTheme.titleMedium),
|
||||
const SizedBox(height: 8),
|
||||
@@ -78,7 +118,7 @@ class SettingsScreen extends StatelessWidget {
|
||||
const ListTile(
|
||||
leading: Icon(Icons.apps),
|
||||
title: Text(kAppName),
|
||||
subtitle: Text('Generic Flutter Android starter'),
|
||||
subtitle: Text('Personal bank data via Enable Banking'),
|
||||
),
|
||||
const Divider(height: 1),
|
||||
const ListTile(
|
||||
|
||||
Reference in New Issue
Block a user