Skip to content

Commit 02cb1fd

Browse files
Merge pull request #21 from StabilityNexus/mergedOrgTrees
Merged org trees
2 parents 7a477d8 + 34c4bb1 commit 02cb1fd

50 files changed

Lines changed: 12343 additions & 1072 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.stencil

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#API KEYS AND SECRETS
22

3-
API_KEY=
4-
API_SECRET=
3+
PINATA_API_KEY=
4+
PINATA_API_SECRET=
55
ALCHEMY_API_KEY=
66

77
#APPLICATION CONFIGURATION

lib/components/bottom_navigation_widget.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:flutter/material.dart';
22
import 'package:go_router/go_router.dart';
33
import 'package:tree_planting_protocol/utils/constants/bottom_nav_constants.dart';
4+
import 'package:tree_planting_protocol/utils/constants/ui/color_constants.dart';
45

56
class BottomNavigationWidget extends StatelessWidget {
67
final String currentRoute;
@@ -24,9 +25,9 @@ class BottomNavigationWidget extends StatelessWidget {
2425
return BottomNavigationBar(
2526
currentIndex: _getCurrentIndex(),
2627
type: BottomNavigationBarType.fixed,
27-
selectedItemColor: Theme.of(context).colorScheme.primary,
28-
unselectedItemColor: Theme.of(context).colorScheme.onSurfaceVariant,
29-
backgroundColor: const Color.fromARGB(255, 37, 236, 147),
28+
selectedItemColor: getThemeColors(context)['secondary'],
29+
unselectedItemColor: getThemeColors(context)['textSecondary'],
30+
backgroundColor: getThemeColors(context)['primary'],
3031
elevation: 8,
3132
onTap: (index) {
3233
final route = BottomNavConstants.items[index].route;
Lines changed: 256 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,256 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:flutter/services.dart';
3+
import 'package:tree_planting_protocol/utils/constants/ui/color_constants.dart';
4+
import 'package:tree_planting_protocol/utils/constants/ui/dimensions.dart';
5+
6+
class TransactionDialog extends StatelessWidget {
7+
final String title;
8+
final String message;
9+
final String? transactionHash;
10+
final bool isSuccess;
11+
final VoidCallback? onClose;
12+
13+
const TransactionDialog({
14+
super.key,
15+
required this.title,
16+
required this.message,
17+
this.transactionHash,
18+
this.isSuccess = true,
19+
this.onClose,
20+
});
21+
22+
@override
23+
Widget build(BuildContext context) {
24+
final colors = getThemeColors(context);
25+
26+
return Dialog(
27+
backgroundColor: colors['background'],
28+
shape: RoundedRectangleBorder(
29+
borderRadius: BorderRadius.circular(buttonCircularRadius),
30+
side: BorderSide(
31+
color: colors['border']!,
32+
width: buttonborderWidth,
33+
),
34+
),
35+
child: Container(
36+
constraints: const BoxConstraints(maxWidth: 400),
37+
padding: const EdgeInsets.all(24),
38+
decoration: BoxDecoration(
39+
color: colors['background'],
40+
borderRadius: BorderRadius.circular(buttonCircularRadius),
41+
),
42+
child: SingleChildScrollView(
43+
child: Column(
44+
mainAxisSize: MainAxisSize.min,
45+
crossAxisAlignment: CrossAxisAlignment.start,
46+
children: [
47+
// Header with icon and title
48+
Row(
49+
children: [
50+
Container(
51+
padding: const EdgeInsets.all(8),
52+
decoration: BoxDecoration(
53+
color: isSuccess ? colors['primary'] : colors['error'],
54+
borderRadius: BorderRadius.circular(8),
55+
border: Border.all(
56+
color: colors['border']!,
57+
width: 2,
58+
),
59+
),
60+
child: Icon(
61+
isSuccess ? Icons.check_circle : Icons.error,
62+
color: colors['textPrimary'],
63+
size: 24,
64+
),
65+
),
66+
const SizedBox(width: 12),
67+
Expanded(
68+
child: Text(
69+
title,
70+
style: TextStyle(
71+
fontSize: 20,
72+
fontWeight: FontWeight.bold,
73+
color: colors['textPrimary'],
74+
),
75+
),
76+
),
77+
],
78+
),
79+
const SizedBox(height: 20),
80+
81+
// Message
82+
Text(
83+
message,
84+
style: TextStyle(
85+
fontSize: 14,
86+
color: colors['textPrimary'],
87+
height: 1.5,
88+
),
89+
),
90+
91+
if (transactionHash != null && transactionHash!.isNotEmpty) ...[
92+
const SizedBox(height: 20),
93+
Container(
94+
padding: const EdgeInsets.all(12),
95+
decoration: BoxDecoration(
96+
color: colors['secondary'],
97+
borderRadius: BorderRadius.circular(8),
98+
border: Border.all(
99+
color: colors['border']!,
100+
width: 2,
101+
),
102+
),
103+
child: Column(
104+
crossAxisAlignment: CrossAxisAlignment.start,
105+
children: [
106+
Row(
107+
children: [
108+
Icon(
109+
Icons.receipt_long,
110+
size: 16,
111+
color: colors['textPrimary'],
112+
),
113+
const SizedBox(width: 8),
114+
Text(
115+
'Transaction Hash',
116+
style: TextStyle(
117+
fontSize: 12,
118+
fontWeight: FontWeight.bold,
119+
color: colors['textPrimary'],
120+
),
121+
),
122+
],
123+
),
124+
const SizedBox(height: 8),
125+
Row(
126+
children: [
127+
Expanded(
128+
child: Text(
129+
'${transactionHash!.substring(0, 10)}...${transactionHash!.substring(transactionHash!.length - 8)}',
130+
style: TextStyle(
131+
fontSize: 12,
132+
fontFamily: 'monospace',
133+
color: colors['textPrimary'],
134+
),
135+
),
136+
),
137+
IconButton(
138+
padding: EdgeInsets.zero,
139+
constraints: const BoxConstraints(),
140+
onPressed: () {
141+
Clipboard.setData(
142+
ClipboardData(text: transactionHash!));
143+
ScaffoldMessenger.of(context).showSnackBar(
144+
SnackBar(
145+
content: const Text('Hash copied!'),
146+
duration: const Duration(seconds: 1),
147+
backgroundColor: colors['primary'],
148+
),
149+
);
150+
},
151+
icon: Icon(
152+
Icons.copy,
153+
size: 16,
154+
color: colors['textPrimary'],
155+
),
156+
),
157+
],
158+
),
159+
],
160+
),
161+
),
162+
],
163+
164+
const SizedBox(height: 24),
165+
166+
// Close Button
167+
SizedBox(
168+
width: double.infinity,
169+
height: 50,
170+
child: Material(
171+
elevation: 4,
172+
borderRadius: BorderRadius.circular(buttonCircularRadius),
173+
child: InkWell(
174+
onTap: () {
175+
Navigator.of(context).pop();
176+
if (onClose != null) onClose!();
177+
},
178+
borderRadius: BorderRadius.circular(buttonCircularRadius),
179+
child: Container(
180+
decoration: BoxDecoration(
181+
color:
182+
isSuccess ? colors['primary'] : colors['secondary'],
183+
border: Border.all(
184+
color: colors['border']!,
185+
width: buttonborderWidth,
186+
),
187+
borderRadius:
188+
BorderRadius.circular(buttonCircularRadius),
189+
),
190+
child: Center(
191+
child: Text(
192+
'Close',
193+
style: TextStyle(
194+
color: colors['textPrimary'],
195+
fontSize: 16,
196+
fontWeight: FontWeight.bold,
197+
),
198+
),
199+
),
200+
),
201+
),
202+
),
203+
),
204+
],
205+
),
206+
),
207+
),
208+
);
209+
}
210+
211+
static void showSuccess(
212+
BuildContext context, {
213+
required String title,
214+
required String message,
215+
String? transactionHash,
216+
VoidCallback? onClose,
217+
}) {
218+
WidgetsBinding.instance.addPostFrameCallback((_) {
219+
if (context.mounted) {
220+
showDialog(
221+
context: context,
222+
barrierDismissible: false,
223+
builder: (context) => TransactionDialog(
224+
title: title,
225+
message: message,
226+
transactionHash: transactionHash,
227+
isSuccess: true,
228+
onClose: onClose,
229+
),
230+
);
231+
}
232+
});
233+
}
234+
235+
static void showError(
236+
BuildContext context, {
237+
required String title,
238+
required String message,
239+
VoidCallback? onClose,
240+
}) {
241+
WidgetsBinding.instance.addPostFrameCallback((_) {
242+
if (context.mounted) {
243+
showDialog(
244+
context: context,
245+
barrierDismissible: false,
246+
builder: (context) => TransactionDialog(
247+
title: title,
248+
message: message,
249+
isSuccess: false,
250+
onClose: onClose,
251+
),
252+
);
253+
}
254+
});
255+
}
256+
}

0 commit comments

Comments
 (0)