mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-26 06:08:40 +01:00
* Label new-UI dashboard navigation and sync status for screen readers Each bottom-nav tab becomes one button node carrying its localized name, its selected state and mutual exclusion; the pill text no longer duplicates the selected tab. The assets/history tabs gain selected state, the Bitcoin/Lightning switcher becomes a labeled toggle, and the sync bar becomes a single button whose label is the localized status (plus Tor/MWEB/Silent Payments badges) with a hint pointing at node management. Compact mode's pulsing dot and the chain icon's progress ring now have text equivalents, and the invisible pointer-absorbing strip behind the nav bar is excluded from traversal. * Make new-UI dashboard cards, lists and menus operable by screen readers Collapse the wallet-name row into one labeled button (hardware-wallet glyph folded into the label, inner accounts button no longer a second stop) and give balance cards a labeled, selectable node with a long-press action for show/hide balance. Balances hidden behind AnimatedOpacity, card artwork and decorative glyphs leave the semantics tree; the 3-dots customize target and the card action buttons are now named buttons. Assets/history rows, the history header, the MWEB promo, long-press menu items, the account cards and the add-account and generate-name controls become single button nodes, the phantom action chip in the assets header is built conditionally instead of drawn at opacity 0, and app cards get a close tooltip plus an 'opens externally' hint. * Use expression bodies for the new a11y helpers * Restore untouched expressions in cards_view * Address review: state-aware balance hint, tooltip-free close label * Address review: keep header height without the chip, name the selected index
174 lines
6.1 KiB
Dart
174 lines
6.1 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:cake_wallet/di.dart';
|
|
import 'package:cake_wallet/entities/preferences_key.dart';
|
|
import 'package:cake_wallet/new-ui/pages/home_page.dart';
|
|
import 'package:cake_wallet/new-ui/widgets/changelog_modal.dart';
|
|
import 'package:cake_wallet/src/screens/contact/contact_list_page.dart';
|
|
import 'package:cake_wallet/src/screens/dashboard/pages/cake_features_page.dart';
|
|
import 'package:cake_wallet/src/screens/dashboard/widgets/new_main_navbar_widget.dart';
|
|
import 'package:cake_wallet/src/screens/wallet_connect/services/bottom_sheet_service.dart';
|
|
import 'package:cake_wallet/src/screens/wallet_connect/widgets/bottom_sheet/bottom_sheet_listener_widget.dart';
|
|
import 'package:cake_wallet/src/screens/wallet_list/wallet_list_page.dart';
|
|
import 'package:cake_wallet/src/widgets/vulnerable_seeds_popup.dart';
|
|
import 'package:cake_wallet/utils/show_pop_up.dart';
|
|
import 'package:cake_wallet/utils/version_comparator.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:mobx/mobx.dart';
|
|
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
import '../view_model/dashboard/dashboard_view_model.dart';
|
|
|
|
class NewDashboard extends StatefulWidget {
|
|
NewDashboard({
|
|
super.key,
|
|
required this.dashboardViewModel,
|
|
required this.bottomSheetService,
|
|
});
|
|
|
|
final DashboardViewModel dashboardViewModel;
|
|
final BottomSheetService bottomSheetService;
|
|
|
|
final List<Widget> dashboardPageWidgets = [
|
|
getIt.get<NewHomePage>(),
|
|
getIt.get<WalletListPage>(),
|
|
getIt.get<ContactListPage>(),
|
|
getIt.get<CakeFeaturesPage>(),
|
|
Placeholder(),
|
|
];
|
|
|
|
@override
|
|
State<NewDashboard> createState() => _NewDashboardState();
|
|
}
|
|
|
|
class _NewDashboardState extends State<NewDashboard> {
|
|
int _selectedPage = 0;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
reaction((_) => widget.dashboardViewModel.appStore.wallet, (_) {
|
|
setState(() {
|
|
_selectedPage = 0;
|
|
});
|
|
});
|
|
|
|
Future.delayed(Duration(milliseconds: 300)).then((_) => _showChangelog(context));
|
|
_showVulnerableSeedsPopup(context);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BottomSheetListener(
|
|
bottomSheetService: widget.bottomSheetService,
|
|
child: CupertinoScaffold(
|
|
body: Material(
|
|
child: Stack(
|
|
alignment: Alignment.bottomCenter,
|
|
children: [
|
|
// widget.dashboardPageWidgets[_selectedPage],
|
|
IndexedStack(
|
|
index: _selectedPage,
|
|
children: widget.dashboardPageWidgets,
|
|
),
|
|
IgnorePointer(
|
|
child: Container(
|
|
height: 150,
|
|
decoration: BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topCenter,
|
|
end: Alignment.bottomCenter,
|
|
colors: <Color>[
|
|
Theme.of(context).colorScheme.surfaceDim.withAlpha(5),
|
|
Theme.of(context).colorScheme.surfaceDim.withAlpha(50),
|
|
Theme.of(context).colorScheme.surfaceDim.withAlpha(100),
|
|
Theme.of(context).colorScheme.surfaceDim.withAlpha(150),
|
|
Theme.of(context).colorScheme.surfaceDim.withAlpha(200),
|
|
Theme.of(context).colorScheme.surfaceDim.withAlpha(200),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
// Invisible pointer-absorbing strip behind the nav bar: it must not
|
|
// be reachable by screen-reader traversal either.
|
|
ExcludeSemantics(
|
|
child: SafeArea(
|
|
bottom: !(Platform.isIOS),
|
|
child: SizedBox(
|
|
width: double.infinity,
|
|
height: NewMainNavBar.barHeight + NewMainNavBar.barBottomPadding,
|
|
child: AbsorbPointer(
|
|
absorbing: true,
|
|
child: Container(color: Colors.transparent),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
NewMainNavBar(
|
|
dashboardViewModel: widget.dashboardViewModel,
|
|
selectedIndex: _selectedPage,
|
|
onItemTap: (index) {
|
|
setState(() {
|
|
_selectedPage = index;
|
|
});
|
|
},
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
void _showChangelog(BuildContext context) async {
|
|
final sharedPrefs = await SharedPreferences.getInstance();
|
|
final currentAppVersion = VersionComparator.getExtendedVersionNumber(
|
|
widget.dashboardViewModel.settingsStore.appVersion);
|
|
final lastSeenAppVersion = sharedPrefs.getInt(PreferencesKey.lastSeenAppVersion);
|
|
final isNewInstall = sharedPrefs.getBool(PreferencesKey.isNewInstall) ?? true;
|
|
|
|
if (currentAppVersion != lastSeenAppVersion && !isNewInstall) {
|
|
Future<void>.delayed(
|
|
Duration(seconds: 1),
|
|
() {
|
|
if (context.mounted) {
|
|
showModalBottomSheet(
|
|
isScrollControlled: true,
|
|
context: context,
|
|
builder: (context) {
|
|
return ChangelogModal(
|
|
version: widget.dashboardViewModel.settingsStore.appVersion,
|
|
);
|
|
});
|
|
}
|
|
},
|
|
);
|
|
|
|
sharedPrefs.setInt(PreferencesKey.lastSeenAppVersion, currentAppVersion);
|
|
} else if (isNewInstall) {
|
|
sharedPrefs.setInt(PreferencesKey.lastSeenAppVersion, currentAppVersion);
|
|
}
|
|
}
|
|
|
|
void _showVulnerableSeedsPopup(BuildContext context) async {
|
|
final List<String> affectedWalletNames = await widget.dashboardViewModel.checkAffectedWallets();
|
|
|
|
if (affectedWalletNames.isNotEmpty) {
|
|
Future<void>.delayed(
|
|
Duration(seconds: 1),
|
|
() {
|
|
if (context.mounted) {
|
|
showPopUp<void>(
|
|
context: context,
|
|
builder: (BuildContext context) {
|
|
return VulnerableSeedsPopup(affectedWalletNames);
|
|
},
|
|
);
|
|
}
|
|
},
|
|
);
|
|
}
|
|
}
|
|
}
|