Skip to content

Commit

Permalink
fixes some UI in samples
Browse files Browse the repository at this point in the history
  • Loading branch information
quetool committed Jan 31, 2025
1 parent b1d1439 commit e356bed
Show file tree
Hide file tree
Showing 11 changed files with 151 additions and 131 deletions.
7 changes: 1 addition & 6 deletions packages/reown_appkit/example/base/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -478,12 +478,8 @@ class _MyHomePageState extends State<MyHomePage> {
);

return Scaffold(
backgroundColor: ReownAppKitModalTheme.colorsOf(context).background125,
appBar: AppBar(
backgroundColor: ReownAppKitModalTheme.colorsOf(context).background175,
foregroundColor: ReownAppKitModalTheme.colorsOf(context).foreground100,
title: Text(_pageDatas[_selectedIndex].title),
centerTitle: true,
actions: [
const Text('Relay '),
CircleAvatar(
Expand Down Expand Up @@ -514,10 +510,9 @@ class _MyHomePageState extends State<MyHomePage> {

Widget _buildBottomNavBar() {
return BottomNavigationBar(
backgroundColor: ReownAppKitModalTheme.colorsOf(context).background175,
currentIndex: _selectedIndex,
unselectedItemColor: Colors.grey,
selectedItemColor: Colors.indigoAccent,
selectedItemColor: Color(0xFF667DFF),
showUnselectedLabels: true,
type: BottomNavigationBarType.fixed,
// called when one tab is selected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class StringConstants {
static const String testnetsOnly = 'Testnets only?';
static const String scanQrCode = 'Scan QR Code';
static const String copiedToClipboard = 'Copied to clipboard';
static const String connect = 'Connect';
static const String connectionEstablished = 'Session established';
static const String connectionFailed = 'Session setup failed';
static const String connectionRejected = 'Connection rejected by user';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ class MagicService implements IMagicService {
),
);
await _setDebugMode();
await _clearCookies();
// await _clearCookies();
await _clearStorage();
await _loadRequest();
return await _initializedCompleter.future;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,43 +54,39 @@ class BottomSheetListenerState extends State<BottomSheetListener> {
}
});
}
return Container(
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(StyleConstants.linear16),
),
),
padding: EdgeInsets.only(
top: StyleConstants.linear16,
left: StyleConstants.linear16,
right: StyleConstants.linear16,
bottom: MediaQuery.of(context).viewInsets.bottom +
StyleConstants.linear16,
),
margin: const EdgeInsets.all(
StyleConstants.linear16,
return Material(
borderRadius: BorderRadius.all(
Radius.circular(StyleConstants.linear16),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
IconButton(
padding: const EdgeInsets.all(0.0),
visualDensity: VisualDensity.compact,
onPressed: () {
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
},
icon: const Icon(Icons.close_sharp),
),
],
),
Flexible(child: item.widget),
],
child: Padding(
padding: EdgeInsets.only(
top: StyleConstants.linear16,
left: StyleConstants.linear16,
right: StyleConstants.linear16,
bottom: MediaQuery.of(context).viewInsets.bottom +
StyleConstants.linear24,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
IconButton(
padding: const EdgeInsets.all(0.0),
visualDensity: VisualDensity.compact,
onPressed: () {
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
},
icon: const Icon(Icons.close_sharp),
),
],
),
Flexible(child: item.widget),
],
),
),
);
},
Expand Down
55 changes: 51 additions & 4 deletions packages/reown_walletkit/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,60 @@ Future<void> main() async {
runApp(const MyApp());
}

class MyApp extends StatelessWidget {
class MyApp extends StatefulWidget {
const MyApp({super.key});

// This widget is the root of your application.
@override
State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
bool _isDarkMode = false;

@override
void initState() {
super.initState();
WidgetsBinding.instance.addObserver(this);
WidgetsBinding.instance.addPostFrameCallback((_) {
setState(() {
final platformDispatcher = View.of(context).platformDispatcher;
final platformBrightness = platformDispatcher.platformBrightness;
_isDarkMode = platformBrightness == Brightness.dark;
});
});
}

@override
void dispose() {
WidgetsBinding.instance.removeObserver(this);
super.dispose();
}

@override
void didChangePlatformBrightness() {
if (mounted) {
setState(() {
final platformDispatcher = View.of(context).platformDispatcher;
final platformBrightness = platformDispatcher.platformBrightness;
_isDarkMode = platformBrightness == Brightness.dark;
});
}
super.didChangePlatformBrightness();
}

@override
Widget build(BuildContext context) {
return MaterialApp(
title: StringConstants.appTitle,
theme: ThemeData(
colorScheme: _isDarkMode
? ColorScheme.dark(
primary: Color(0xFF667DFF),
)
: ColorScheme.light(
primary: Color(0xFF667DFF),
),
),
home: MyHomePage(),
);
}
Expand Down Expand Up @@ -176,7 +222,6 @@ class _MyHomePageState extends State<MyHomePage> {
appBar: AppBar(
title: Text(
_pageDatas[_selectedIndex].title,
style: const TextStyle(color: Colors.black),
),
actions: [
const Text('Relay '),
Expand Down Expand Up @@ -206,7 +251,9 @@ class _MyHomePageState extends State<MyHomePage> {
return BottomNavigationBar(
currentIndex: _selectedIndex,
unselectedItemColor: Colors.grey,
selectedItemColor: Colors.black,
selectedItemColor: Color(0xFF667DFF),
showUnselectedLabels: true,
type: BottomNavigationBarType.fixed,
// called when one tab is selected
onTap: (int index) {
setState(() {
Expand Down
2 changes: 1 addition & 1 deletion packages/reown_walletkit/example/lib/pages/apps_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class AppsPageState extends State<AppsPage> {
Widget _buildIconButton(IconData icon, void Function()? onPressed) {
return Container(
decoration: BoxDecoration(
color: StyleConstants.primaryColor,
color: Color(0xFF667DFF),
borderRadius: BorderRadius.circular(
StyleConstants.linear48,
),
Expand Down
51 changes: 25 additions & 26 deletions packages/reown_walletkit/example/lib/pages/settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,22 @@ class _SettingsPageState extends State<SettingsPage> {
),
//
const SizedBox(height: 20.0),
const Divider(height: 1.0),
const Divider(height: 1.0, color: Colors.grey),
_SolanaAccounts(),
const SizedBox(height: 20.0),
const Divider(height: 1.0),
const Divider(height: 1.0, color: Colors.grey),
_PolkadotAccounts(),
const SizedBox(height: 20.0),
const Divider(height: 1.0),
const Divider(height: 1.0, color: Colors.grey),
_KadenaAccounts(),
const SizedBox(height: 20.0),
const Divider(height: 1.0),
const Divider(height: 1.0, color: Colors.grey),
_DeviceData(),
const SizedBox(height: 20.0),
const Divider(height: 1.0),
const Divider(height: 1.0, color: Colors.grey),
_Metadata(),
const SizedBox(height: 20.0),
const Divider(height: 1.0),
const Divider(height: 1.0, color: Colors.grey),
_Buttons(
onDeleteData: () async {
final walletKit = GetIt.I<IWalletKitService>().walletKit;
Expand Down Expand Up @@ -208,7 +208,6 @@ class _EVMAccountsState extends State<_EVMAccounts> {
child: Text(
'EVM Accounts (${_currentPage + 1}/${chainKeys.length})',
style: const TextStyle(
color: Colors.black,
fontSize: 16.0,
fontWeight: FontWeight.w500,
),
Expand Down Expand Up @@ -355,8 +354,9 @@ class _EVMAccountsState extends State<_EVMAccounts> {
padding: const EdgeInsets.symmetric(horizontal: 2.0),
child: CircleAvatar(
radius: e.$1 == _currentPage ? 4.0 : 3.0,
backgroundColor:
e.$1 == _currentPage ? Colors.black : Colors.black38,
backgroundColor: e.$1 == _currentPage
? StyleConstants.lightGray
: StyleConstants.lightGray.withOpacity(0.5),
),
),
)
Expand Down Expand Up @@ -426,7 +426,6 @@ class _SolanaAccountsState extends State<_SolanaAccounts> {
child: Text(
'Solana Account',
style: TextStyle(
color: Colors.black,
fontSize: 16.0,
fontWeight: FontWeight.w500,
),
Expand Down Expand Up @@ -509,7 +508,6 @@ class _PolkadotAccounts extends StatelessWidget {
child: Text(
'Polkadot Account',
style: TextStyle(
color: Colors.black,
fontSize: 16.0,
fontWeight: FontWeight.w500,
),
Expand Down Expand Up @@ -557,7 +555,6 @@ class _KadenaAccounts extends StatelessWidget {
child: Text(
'Kadena Account',
style: TextStyle(
color: Colors.black,
fontSize: 16.0,
fontWeight: FontWeight.w500,
),
Expand Down Expand Up @@ -602,7 +599,6 @@ class _DeviceData extends StatelessWidget {
child: Text(
'Device',
style: TextStyle(
color: Colors.black,
fontSize: 16.0,
fontWeight: FontWeight.w500,
),
Expand Down Expand Up @@ -656,23 +652,28 @@ class _Buttons extends StatelessWidget {
child: Column(
children: [
const SizedBox(height: 8.0),
SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: onDeleteData,
child: Text(
'Clear local storage',
style: TextStyle(
fontWeight: FontWeight.bold,
Row(
children: [
CustomButton(
type: CustomButtonType.normal,
onTap: onDeleteData,
child: const Center(
child: Text(
'Clear local storage',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
),
),
],
),
const SizedBox(height: 12.0),
Row(
children: [
CustomButton(
type: CustomButtonType.normal,
type: CustomButtonType.valid,
onTap: onRestoreFromSeed,
child: const Center(
child: Text(
Expand Down Expand Up @@ -756,7 +757,7 @@ class __DataContainerState extends State<_DataContainer> {
child: Container(
height: widget.height,
decoration: BoxDecoration(
color: StyleConstants.lightGray,
color: StyleConstants.lightGray.withOpacity(0.5),
borderRadius: BorderRadius.circular(
StyleConstants.linear16,
),
Expand All @@ -770,7 +771,6 @@ class __DataContainerState extends State<_DataContainer> {
Text(
widget.title,
style: const TextStyle(
color: Colors.black,
fontSize: 14.0,
fontWeight: FontWeight.bold,
),
Expand All @@ -788,7 +788,6 @@ class __DataContainerState extends State<_DataContainer> {
child: Text(
widget.data,
style: const TextStyle(
color: Colors.black87,
fontSize: 13.0,
fontWeight: FontWeight.w400,
),
Expand Down
Loading

0 comments on commit e356bed

Please sign in to comment.