-
Notifications
You must be signed in to change notification settings - Fork 19
Merged org trees #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Merged org trees #21
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
3e9585a
feat: add inidivdial organisation page
IronJam11 1e6af34
add: basic UI for organisation details page
IronJam11 2376a1c
feat: integrate add member and remove member functionality
IronJam11 a38c804
fix: contract updates integration
IronJam11 b0d2a2b
add: verifier tokens widget
IronJam11 377a515
fix: geohash coordinates functionality
IronJam11 a7ce3ea
chore: improve ui of the tree details form
IronJam11 182f2c6
fix: wallet provider session
IronJam11 a6358bf
ui: tabs division on organisation page
IronJam11 1ed472a
feat: add tabs for verification requests and tree planting proposals …
IronJam11 9243c43
feat: all trees page end to end integration
IronJam11 d0830b8
chore: remove build issues
IronJam11 9ffbdb0
chore: add planting proposal functionality
IronJam11 f9d579b
chore: fix verifier token list view and add better ui styling
IronJam11 12b6cd1
Merge branch 'allTreesPage' into mergedOrgTrees
IronJam11 a7fa81f
feat: view user functionality
IronJam11 34c4bb1
ui: format dialog box for contract interaction result
IronJam11 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,256 @@ | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:flutter/services.dart'; | ||
| import 'package:tree_planting_protocol/utils/constants/ui/color_constants.dart'; | ||
| import 'package:tree_planting_protocol/utils/constants/ui/dimensions.dart'; | ||
|
|
||
| class TransactionDialog extends StatelessWidget { | ||
| final String title; | ||
| final String message; | ||
| final String? transactionHash; | ||
| final bool isSuccess; | ||
| final VoidCallback? onClose; | ||
|
|
||
| const TransactionDialog({ | ||
| super.key, | ||
| required this.title, | ||
| required this.message, | ||
| this.transactionHash, | ||
| this.isSuccess = true, | ||
| this.onClose, | ||
| }); | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| final colors = getThemeColors(context); | ||
|
|
||
| return Dialog( | ||
| backgroundColor: colors['background'], | ||
| shape: RoundedRectangleBorder( | ||
| borderRadius: BorderRadius.circular(buttonCircularRadius), | ||
| side: BorderSide( | ||
| color: colors['border']!, | ||
| width: buttonborderWidth, | ||
| ), | ||
| ), | ||
| child: Container( | ||
| constraints: const BoxConstraints(maxWidth: 400), | ||
| padding: const EdgeInsets.all(24), | ||
| decoration: BoxDecoration( | ||
| color: colors['background'], | ||
| borderRadius: BorderRadius.circular(buttonCircularRadius), | ||
| ), | ||
| child: SingleChildScrollView( | ||
| child: Column( | ||
| mainAxisSize: MainAxisSize.min, | ||
| crossAxisAlignment: CrossAxisAlignment.start, | ||
| children: [ | ||
| // Header with icon and title | ||
| Row( | ||
| children: [ | ||
| Container( | ||
| padding: const EdgeInsets.all(8), | ||
| decoration: BoxDecoration( | ||
| color: isSuccess ? colors['primary'] : colors['error'], | ||
| borderRadius: BorderRadius.circular(8), | ||
| border: Border.all( | ||
| color: colors['border']!, | ||
| width: 2, | ||
| ), | ||
| ), | ||
| child: Icon( | ||
| isSuccess ? Icons.check_circle : Icons.error, | ||
| color: colors['textPrimary'], | ||
| size: 24, | ||
| ), | ||
| ), | ||
| const SizedBox(width: 12), | ||
| Expanded( | ||
| child: Text( | ||
| title, | ||
| style: TextStyle( | ||
| fontSize: 20, | ||
| fontWeight: FontWeight.bold, | ||
| color: colors['textPrimary'], | ||
| ), | ||
| ), | ||
| ), | ||
| ], | ||
| ), | ||
| const SizedBox(height: 20), | ||
|
|
||
| // Message | ||
| Text( | ||
| message, | ||
| style: TextStyle( | ||
| fontSize: 14, | ||
| color: colors['textPrimary'], | ||
| height: 1.5, | ||
| ), | ||
| ), | ||
|
|
||
| if (transactionHash != null && transactionHash!.isNotEmpty) ...[ | ||
| const SizedBox(height: 20), | ||
| Container( | ||
| padding: const EdgeInsets.all(12), | ||
| decoration: BoxDecoration( | ||
| color: colors['secondary'], | ||
| borderRadius: BorderRadius.circular(8), | ||
| border: Border.all( | ||
| color: colors['border']!, | ||
| width: 2, | ||
| ), | ||
| ), | ||
| child: Column( | ||
| crossAxisAlignment: CrossAxisAlignment.start, | ||
| children: [ | ||
| Row( | ||
| children: [ | ||
| Icon( | ||
| Icons.receipt_long, | ||
| size: 16, | ||
| color: colors['textPrimary'], | ||
| ), | ||
| const SizedBox(width: 8), | ||
| Text( | ||
| 'Transaction Hash', | ||
| style: TextStyle( | ||
| fontSize: 12, | ||
| fontWeight: FontWeight.bold, | ||
| color: colors['textPrimary'], | ||
| ), | ||
| ), | ||
| ], | ||
| ), | ||
| const SizedBox(height: 8), | ||
| Row( | ||
| children: [ | ||
| Expanded( | ||
| child: Text( | ||
| '${transactionHash!.substring(0, 10)}...${transactionHash!.substring(transactionHash!.length - 8)}', | ||
| style: TextStyle( | ||
| fontSize: 12, | ||
| fontFamily: 'monospace', | ||
| color: colors['textPrimary'], | ||
| ), | ||
| ), | ||
| ), | ||
| IconButton( | ||
| padding: EdgeInsets.zero, | ||
| constraints: const BoxConstraints(), | ||
| onPressed: () { | ||
| Clipboard.setData( | ||
| ClipboardData(text: transactionHash!)); | ||
| ScaffoldMessenger.of(context).showSnackBar( | ||
| SnackBar( | ||
| content: const Text('Hash copied!'), | ||
| duration: const Duration(seconds: 1), | ||
| backgroundColor: colors['primary'], | ||
| ), | ||
| ); | ||
| }, | ||
| icon: Icon( | ||
| Icons.copy, | ||
| size: 16, | ||
| color: colors['textPrimary'], | ||
| ), | ||
| ), | ||
| ], | ||
| ), | ||
| ], | ||
| ), | ||
| ), | ||
| ], | ||
|
|
||
| const SizedBox(height: 24), | ||
|
|
||
| // Close Button | ||
| SizedBox( | ||
| width: double.infinity, | ||
| height: 50, | ||
| child: Material( | ||
| elevation: 4, | ||
| borderRadius: BorderRadius.circular(buttonCircularRadius), | ||
| child: InkWell( | ||
| onTap: () { | ||
| Navigator.of(context).pop(); | ||
| if (onClose != null) onClose!(); | ||
| }, | ||
| borderRadius: BorderRadius.circular(buttonCircularRadius), | ||
| child: Container( | ||
| decoration: BoxDecoration( | ||
| color: | ||
| isSuccess ? colors['primary'] : colors['secondary'], | ||
| border: Border.all( | ||
| color: colors['border']!, | ||
| width: buttonborderWidth, | ||
| ), | ||
| borderRadius: | ||
| BorderRadius.circular(buttonCircularRadius), | ||
| ), | ||
| child: Center( | ||
| child: Text( | ||
| 'Close', | ||
| style: TextStyle( | ||
| color: colors['textPrimary'], | ||
| fontSize: 16, | ||
| fontWeight: FontWeight.bold, | ||
| ), | ||
| ), | ||
| ), | ||
| ), | ||
| ), | ||
| ), | ||
| ), | ||
| ], | ||
| ), | ||
| ), | ||
| ), | ||
| ); | ||
| } | ||
|
|
||
| static void showSuccess( | ||
| BuildContext context, { | ||
| required String title, | ||
| required String message, | ||
| String? transactionHash, | ||
| VoidCallback? onClose, | ||
| }) { | ||
| WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| if (context.mounted) { | ||
| showDialog( | ||
| context: context, | ||
| barrierDismissible: false, | ||
| builder: (context) => TransactionDialog( | ||
| title: title, | ||
| message: message, | ||
| transactionHash: transactionHash, | ||
| isSuccess: true, | ||
| onClose: onClose, | ||
| ), | ||
| ); | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| static void showError( | ||
| BuildContext context, { | ||
| required String title, | ||
| required String message, | ||
| VoidCallback? onClose, | ||
| }) { | ||
| WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| if (context.mounted) { | ||
| showDialog( | ||
| context: context, | ||
| barrierDismissible: false, | ||
| builder: (context) => TransactionDialog( | ||
| title: title, | ||
| message: message, | ||
| isSuccess: false, | ||
| onClose: onClose, | ||
| ), | ||
| ); | ||
| } | ||
| }); | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guard short hashes to prevent RangeError.
Substring indexes assume length ≥ 18. Build the preview defensively.
🤖 Prompt for AI Agents