diff --git a/threefold_connect/lib/daily_transacations/presentation/pages/daily_transaction.dart b/threefold_connect/lib/daily_transacations/presentation/pages/daily_transaction.dart new file mode 100644 index 0000000..d53281a --- /dev/null +++ b/threefold_connect/lib/daily_transacations/presentation/pages/daily_transaction.dart @@ -0,0 +1,74 @@ +import 'package:flutter/material.dart'; + +import '../widgets/filter.dart'; +import '../widgets/footer.dart'; +import '../widgets/transaction.dart'; +import '../widgets/vertical_divider.dart'; +import '/widgets/app_bar.dart'; + +import '../widgets/header.dart'; + +class DailyTransactionsPage extends StatefulWidget { + const DailyTransactionsPage({super.key}); + + @override + State createState() => _DailyTransactionsPageState(); +} + +class _DailyTransactionsPageState extends State { + String selectedCurrency = 'TFT'; + final List currencies = ['TFT', 'All']; + + void _onCurrencyChanged(String? newCurrency) { + if (newCurrency != null) { + setState(() { + selectedCurrency = newCurrency; + }); + } + } + + @override + Widget build(BuildContext context) { + return SafeArea( + child: Scaffold( + appBar: const MyAppBar(title: 'Wallet'), + body: Column( + children: [ + const WalletInfoHeader(email: 'Daily@username'), + const Divider(), + const SizedBox(height: 16), + FilterWidget( + currencies: currencies, + selectedCurrency: selectedCurrency, + onCurrencyChanged: _onCurrencyChanged, + ), + const SizedBox(height: 16), + Expanded( + child: ListView.builder( + itemCount: 10, + itemBuilder: (context, index) { + return Column( + children: [ + TransactionWidget( + isIncoming: index % 2 == 0, + status: "Completed", + transactionId: + 'VerlyLongTransacationIDkfuiuaiuagigiuagiuwaghwag $index', + tftAmount: 100.0 + index, + date: '2022-01-0${index + 1}', + ), + index != 9 + ? const CustomVerticalDivider() + : const SizedBox(), + ], + ); + }, + ), + ), + const Footer(), + ], + ), + ), + ); + } +} diff --git a/threefold_connect/lib/daily_transacations/presentation/pages/transaction_details.dart b/threefold_connect/lib/daily_transacations/presentation/pages/transaction_details.dart new file mode 100644 index 0000000..dfd82c9 --- /dev/null +++ b/threefold_connect/lib/daily_transacations/presentation/pages/transaction_details.dart @@ -0,0 +1,61 @@ +import 'package:flutter/material.dart'; +import 'package:threefold_connect/daily_transacations/presentation/widgets/footer.dart'; +import 'package:threefold_connect/daily_transacations/presentation/widgets/header.dart'; +import 'package:threefold_connect/daily_transacations/presentation/widgets/transaction_details.dart'; +import 'package:threefold_connect/main.dart'; +import 'package:threefold_connect/widgets/app_bar.dart'; + +class TransactionDetailsPage extends StatelessWidget { + final String transactionId; + final String status; + final String asset; + final String sender; + final String receiver; + final String paymentType; + final String transactionHash; + final String? memo; + final String amount; + final String date; + + const TransactionDetailsPage({ + super.key, + required this.transactionId, + required this.status, + required this.asset, + required this.sender, + required this.receiver, + required this.paymentType, + required this.transactionHash, + required this.amount, + required this.date, + this.memo, + }); + + @override + Widget build(BuildContext context) { + return const Scaffold( + appBar: MyAppBar(title: 'Wallet'), + body: Column( + children: [ + WalletInfoHeader(email: 'Daily@username'), + Divider(), + Expanded( + child: SingleChildScrollView( + child: TransactionDetails( + transactionId: 'aufhiufa', + status: 'idk', + asset: 'TFT', + sender: 'akuakugagak', + receiver: 'wjbfafbafb', + paymentType: 'IDK', + transactionHash: 'iufwiufwiufwif', + amount: 'hmmmmm', + date: 'idk'), + ), + ), + Footer(), + ], + ), + ); + } +} diff --git a/threefold_connect/lib/daily_transacations/presentation/widgets/arrow_inward.dart b/threefold_connect/lib/daily_transacations/presentation/widgets/arrow_inward.dart new file mode 100644 index 0000000..c50d7c1 --- /dev/null +++ b/threefold_connect/lib/daily_transacations/presentation/widgets/arrow_inward.dart @@ -0,0 +1,19 @@ +import 'package:flutter/material.dart'; +import 'dart:math' as math; + +class ArrowInward extends StatelessWidget { + const ArrowInward({ + Key? key, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Transform.rotate( + angle: 180 * math.pi / 180, + child: const Icon( + Icons.arrow_outward, + color: Colors.white, + ), + ); + } +} diff --git a/threefold_connect/lib/daily_transacations/presentation/widgets/filter.dart b/threefold_connect/lib/daily_transacations/presentation/widgets/filter.dart new file mode 100644 index 0000000..3120287 --- /dev/null +++ b/threefold_connect/lib/daily_transacations/presentation/widgets/filter.dart @@ -0,0 +1,63 @@ +import 'package:flutter/material.dart'; + +class FilterWidget extends StatelessWidget { + final List currencies; + final String selectedCurrency; + final ValueChanged onCurrencyChanged; + + const FilterWidget({ + super.key, + required this.currencies, + required this.selectedCurrency, + required this.onCurrencyChanged, + }); + + @override + Widget build(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Padding( + padding: EdgeInsets.symmetric(horizontal: 16), + child: Text( + 'Filter by Currency', + style: TextStyle(fontSize: 16, color: Colors.white), + ), + ), + const SizedBox(height: 8), + Row( + children: [ + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Container( + decoration: BoxDecoration( + color: Theme.of(context).scaffoldBackgroundColor, + border: Border.all(color: Theme.of(context).primaryColor), + borderRadius: BorderRadius.circular(8), + ), + padding: const EdgeInsets.symmetric(horizontal: 16), + child: DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Theme.of(context).scaffoldBackgroundColor, + style: const TextStyle(color: Colors.white), + value: selectedCurrency, + onChanged: onCurrencyChanged, + items: currencies + .map>((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), + ), + ), + ), + ), + ), + ], + ), + ], + ); + } +} diff --git a/threefold_connect/lib/daily_transacations/presentation/widgets/footer.dart b/threefold_connect/lib/daily_transacations/presentation/widgets/footer.dart new file mode 100644 index 0000000..d2c9dae --- /dev/null +++ b/threefold_connect/lib/daily_transacations/presentation/widgets/footer.dart @@ -0,0 +1,45 @@ +import 'package:flutter/material.dart'; +import 'package:threefold_connect/theme/theme.dart'; + +class Footer extends StatelessWidget { + const Footer({super.key}); + + @override + Widget build(BuildContext context) { + return BottomAppBar( + color: Theme.of(context).scaffoldBackgroundColor, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + _buildFooterButton(Icons.money, () { + // Handle button press + }), + _buildFooterButton(Icons.compare_arrows_sharp, () { + // Handle button press + }), + _buildFooterButton(Icons.info_outline, () { + // Handle button press + }), + ], + ), + ); + } + + Widget _buildFooterButton(IconData icon, VoidCallback onPressed) { + return Expanded( + child: Container( + margin: const EdgeInsets.all(8.0), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: darkgrey, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(0), + ), + ), + onPressed: onPressed, + child: Icon(icon), + ), + ), + ); + } +} diff --git a/threefold_connect/lib/daily_transacations/presentation/widgets/header.dart b/threefold_connect/lib/daily_transacations/presentation/widgets/header.dart new file mode 100644 index 0000000..3477a20 --- /dev/null +++ b/threefold_connect/lib/daily_transacations/presentation/widgets/header.dart @@ -0,0 +1,43 @@ +import 'package:flutter/material.dart'; + +class WalletInfoHeader extends StatelessWidget { + final String email; + + const WalletInfoHeader({super.key, required this.email}); + + @override + Widget build(BuildContext context) { + return Container( + padding: const EdgeInsets.all(16), + child: Row( + children: [ + const Icon(Icons.wallet), + Expanded( + child: Align( + alignment: Alignment.center, + child: Column( + children: [ + const Text( + 'Daily', + style: TextStyle( + fontSize: 20, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + Text( + email, + style: const TextStyle( + fontSize: 16, + color: Colors.white, + ), + ), + ], + ), + ), + ), + ], + ), + ); + } +} diff --git a/threefold_connect/lib/daily_transacations/presentation/widgets/transaction.dart b/threefold_connect/lib/daily_transacations/presentation/widgets/transaction.dart new file mode 100644 index 0000000..5bf8838 --- /dev/null +++ b/threefold_connect/lib/daily_transacations/presentation/widgets/transaction.dart @@ -0,0 +1,119 @@ +import 'package:flutter/material.dart'; +import 'package:threefold_connect/daily_transacations/presentation/pages/transaction_details.dart'; +import 'package:threefold_connect/daily_transacations/presentation/widgets/arrow_inward.dart'; +import 'package:threefold_connect/theme/theme.dart'; + +class TransactionWidget extends StatelessWidget { + final bool isIncoming; + final String transactionId; + final double tftAmount; + final String date; + final String status; + + const TransactionWidget({ + super.key, + required this.isIncoming, + required this.transactionId, + required this.tftAmount, + required this.date, + required this.status, + }); + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: () { + ; + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const TransactionDetailsPage( + transactionId: "uafaiuhfiaifh", + status: "aufhua", + asset: "TFT", + sender: "akuagugk", + receiver: "jagyaf", + paymentType: "idk", + transactionHash: "ajfiufuhia", + amount: "weeee", + date: "fjywfua", + memo: "idk"), + ), + ); + }, + child: Container( + padding: const EdgeInsets.all(16), + child: Row( + children: [ + CircleAvatar( + backgroundColor: + isIncoming ? Theme.of(context).primaryColor : brightRed, + child: isIncoming + ? const ArrowInward() + : const Icon( + Icons.arrow_outward, + color: Colors.white, + ), + ), + const SizedBox(width: 8), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + transactionId, + overflow: TextOverflow.ellipsis, + style: const TextStyle( + fontSize: 16, + color: Colors.white, + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + 'TFT $tftAmount', + style: TextStyle( + fontSize: 14, + color: isIncoming ? Colors.green : Colors.red, + ), + ), + Text( + date, + style: const TextStyle( + fontSize: 14, + color: Colors.white, + ), + ), + ], + ), + ], + ), + ), + const SizedBox(width: 8), + Container( + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6), + decoration: BoxDecoration( + color: status == 'Completed' + ? Theme.of(context).primaryColor + : Colors.red, + border: Border.all( + color: status == 'Completed' ? Colors.green : Colors.red, + ), + borderRadius: BorderRadius.circular(20), + ), + child: Text( + status, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + color: status == 'Completed' ? Colors.white : Colors.red, + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/threefold_connect/lib/daily_transacations/presentation/widgets/transaction_details.dart b/threefold_connect/lib/daily_transacations/presentation/widgets/transaction_details.dart new file mode 100644 index 0000000..76117d2 --- /dev/null +++ b/threefold_connect/lib/daily_transacations/presentation/widgets/transaction_details.dart @@ -0,0 +1,106 @@ +import 'package:flutter/material.dart'; +import 'package:threefold_connect/theme/theme.dart'; + +class TransactionDetails extends StatelessWidget { + final String transactionId; + final String status; + final String asset; + final String sender; + final String receiver; + final String paymentType; + final String transactionHash; + final String? memo; + final String amount; + final String date; + + const TransactionDetails({ + super.key, + required this.transactionId, + required this.status, + required this.asset, + required this.sender, + required this.receiver, + required this.paymentType, + required this.transactionHash, + required this.amount, + required this.date, + this.memo, + }); + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + IconButton( + onPressed: () { + Navigator.pop(context); + }, + icon: const Icon(Icons.arrow_back)), + const Text( + 'Transaction Details', + style: TextStyle( + fontSize: 20, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + const SizedBox(height: 16.0), + _buildDetailRow('Sender', sender), + const Divider(), + _buildDetailRow('Receiver', receiver), + const Divider(), + _buildDetailRow('Payment Type', paymentType), + const Divider(), + _buildDetailRow('Amount', amount), + const Divider(), + _buildDetailRow('Asset', asset), + const Divider(), + _buildDetailRow('date', date), + const Divider(), + _buildDetailRow('Transaction Hash', transactionHash), + const Divider(), + _buildDetailRow('memo', memo ?? '...'), + ], + ), + ); + } + + Widget _buildDetailRow(String label, String value) { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + label, + style: const TextStyle( + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ), + const SizedBox(height: 4.0), + Text( + value, + style: const TextStyle( + color: primaryColor, + ), + ), + ], + ), + ), + ], + ), + ); + } +} diff --git a/threefold_connect/lib/daily_transacations/presentation/widgets/vertical_divider.dart b/threefold_connect/lib/daily_transacations/presentation/widgets/vertical_divider.dart new file mode 100644 index 0000000..f862bcd --- /dev/null +++ b/threefold_connect/lib/daily_transacations/presentation/widgets/vertical_divider.dart @@ -0,0 +1,22 @@ +import 'package:flutter/material.dart'; + +class CustomVerticalDivider extends StatelessWidget { + const CustomVerticalDivider({super.key}); + + @override + Widget build(BuildContext context) { + return const Align( + alignment: Alignment.topLeft, + child: Padding( + padding: EdgeInsets.only(left: 35), + child: SizedBox( + height: 40, + child: VerticalDivider( + color: Colors.grey, + width: 2, + ), + ), + ), + ); + } +} diff --git a/threefold_connect/lib/main.dart b/threefold_connect/lib/main.dart index e06c0c4..03ad6cb 100644 --- a/threefold_connect/lib/main.dart +++ b/threefold_connect/lib/main.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.dart'; +import 'package:threefold_connect/daily_transacations/presentation/pages/daily_transaction.dart'; import 'package:threefold_connect/theme/theme.dart'; + void main() { runApp(const MyApp()); } @@ -12,8 +14,8 @@ class MyApp extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', - theme: threefoldTheme, - home: const MyHomePage(title: 'Flutter Demo Home Page'), + theme: threefoldTheme, + home: const DailyTransactionsPage(), ); } } diff --git a/threefold_connect/lib/theme/theme.dart b/threefold_connect/lib/theme/theme.dart index f92309c..29fb2df 100644 --- a/threefold_connect/lib/theme/theme.dart +++ b/threefold_connect/lib/theme/theme.dart @@ -9,6 +9,8 @@ const backgroundColor = Color(0xFF383434); const white = Color(0xFFFFFFFF); const darkred = Color(0xFFA11A1A); const grey = Color(0xFF818181); +const brightRed = Color.fromARGB(255, 255, 0, 0); +const darkgrey = Color(0xFF504c4c); // Fonts var poppins = GoogleFonts.poppins().fontFamily; @@ -16,6 +18,10 @@ var inter = GoogleFonts.inter().fontFamily; var interBold = GoogleFonts.inter(fontWeight: FontWeight.bold).fontFamily; ThemeData threefoldTheme = ThemeData( + dividerTheme: const DividerThemeData( + color: primaryColor, + thickness: 0.5, + ), appBarTheme: const AppBarTheme( backgroundColor: primaryColor, titleTextStyle: TextStyle( diff --git a/threefold_connect/macos/Flutter/GeneratedPluginRegistrant.swift b/threefold_connect/macos/Flutter/GeneratedPluginRegistrant.swift index cccf817..e777c67 100644 --- a/threefold_connect/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/threefold_connect/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,6 +5,8 @@ import FlutterMacOS import Foundation +import path_provider_foundation func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) }