resolved route_generator conflict

This commit is contained in:
ryleedavis 2022-11-09 08:57:41 -07:00
parent 510233255f
commit 041e23a5a5
3 changed files with 152 additions and 2 deletions

View file

@ -0,0 +1,139 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/providers/global/wallets_provider.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
import 'package:stackwallet/widgets/icon_widgets/x_icon.dart';
import 'package:stackwallet/widgets/stack_text_field.dart';
import 'package:stackwallet/widgets/textfield_icon_button.dart';
class DesktopAddressBook extends ConsumerStatefulWidget {
const DesktopAddressBook({Key? key}) : super(key: key);
static const String routeName = "/desktopAddressBook";
@override
ConsumerState<DesktopAddressBook> createState() => _DesktopAddressBook();
}
class _DesktopAddressBook extends ConsumerState<DesktopAddressBook> {
late final TextEditingController _searchController;
late final FocusNode _searchFocusNode;
String filter = "";
@override
void initState() {
_searchController = TextEditingController();
_searchFocusNode = FocusNode();
super.initState();
}
@override
void dispose() {
_searchController.dispose();
_searchFocusNode.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
debugPrint("BUILD: $runtimeType");
final hasWallets = ref.watch(walletsChangeNotifierProvider).hasWallets;
return Column(
mainAxisSize: MainAxisSize.min,
children: [
DesktopAppBar(
isCompactHeight: true,
leading: Row(
children: [
const SizedBox(
width: 24,
),
Text(
"Address Book",
style: STextStyles.desktopH3(context),
)
],
),
),
const SizedBox(height: 53),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: Row(
children: [
SizedBox(
height: 60,
width: 489,
child: ClipRRect(
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
child: TextField(
autocorrect: false,
enableSuggestions: false,
controller: _searchController,
focusNode: _searchFocusNode,
onChanged: (newString) {
setState(() => filter = newString);
},
style: STextStyles.field(context),
decoration: standardInputDecoration(
"Search...",
_searchFocusNode,
context,
).copyWith(
labelStyle: STextStyles.fieldLabel(context)
.copyWith(fontSize: 16),
prefixIcon: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 16,
),
child: SvgPicture.asset(
Assets.svg.search,
width: 16,
height: 16,
),
),
suffixIcon: _searchController.text.isNotEmpty
? Padding(
padding: const EdgeInsets.only(right: 0),
child: UnconstrainedBox(
child: Row(
children: [
TextFieldIconButton(
child: const XIcon(),
onTap: () async {
setState(() {
_searchController.text = "";
filter = "";
});
},
),
],
),
),
)
: null,
),
),
),
),
],
),
),
// Expanded(
// child: hasWallets ? const MyWallets() : const EmptyWallets(),
// ),
],
);
}
}

View file

@ -8,6 +8,8 @@ import 'package:stackwallet/pages_desktop_specific/home/support_and_about_view/d
import 'package:stackwallet/route_generator.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'address_book_view/desktop_address_book.dart';
class DesktopHomeView extends ConsumerStatefulWidget {
const DesktopHomeView({Key? key}) : super(key: key);
@ -31,8 +33,10 @@ class _DesktopHomeViewState extends ConsumerState<DesktopHomeView> {
Container(
color: Colors.red,
),
Container(
color: Colors.orange,
const Navigator(
key: Key("desktopAddressBookHomeKey"),
onGenerateRoute: RouteGenerator.generateRoute,
initialRoute: DesktopAddressBook.routeName,
),
const Navigator(
key: Key("desktopSettingHomeKey"),

View file

@ -86,6 +86,7 @@ import 'package:stackwallet/pages/wallet_view/wallet_view.dart';
import 'package:stackwallet/pages/wallets_view/wallets_view.dart';
import 'package:stackwallet/pages_desktop_specific/create_password/create_password_view.dart';
import 'package:stackwallet/pages_desktop_specific/forgot_password_desktop_view.dart';
import 'package:stackwallet/pages_desktop_specific/home/address_book_view/desktop_address_book.dart';
import 'package:stackwallet/pages_desktop_specific/home/desktop_home_view.dart';
import 'package:stackwallet/pages_desktop_specific/home/desktop_settings_view.dart';
import 'package:stackwallet/pages_desktop_specific/home/my_stack_view/my_stack_view.dart';
@ -1105,6 +1106,12 @@ class RouteGenerator {
builder: (_) => const DesktopAboutView(),
settings: RouteSettings(name: settings.name));
case DesktopAddressBook.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const DesktopAddressBook(),
settings: RouteSettings(name: settings.name));
case WalletKeysDesktopPopup.routeName:
if (args is List<String>) {
return FadePageRoute(