mirror of
				https://github.com/hackku21/loc-chain-app.git
				synced 2025-06-13 12:54:05 +00:00 
			
		
		
		
	basic file management for transactions
This commit is contained in:
		
							parent
							
								
									2283029f31
								
							
						
					
					
						commit
						ffd477bc6f
					
				
							
								
								
									
										52
									
								
								loc_chain_app/lib/pages/history.dart
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								loc_chain_app/lib/pages/history.dart
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,52 @@
 | 
			
		||||
import 'package:flutter/material.dart';
 | 
			
		||||
 | 
			
		||||
class HomePage extends StatefulWidget {
 | 
			
		||||
  HomePage({Key? key, required this.title}) : super(key: key);
 | 
			
		||||
  final String title;
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  _HomePageState createState() => _HomePageState();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class _HomePageState extends State<HomePage> {
 | 
			
		||||
  int _counter = 0;
 | 
			
		||||
 | 
			
		||||
  void _incrementCounter() {
 | 
			
		||||
    setState(() {
 | 
			
		||||
      // This call to setState tells the Flutter framework that something has
 | 
			
		||||
      // changed in this State, which causes it to rerun the build method below
 | 
			
		||||
      // so that the display can reflect the updated values. If we changed
 | 
			
		||||
      // _counter without calling setState(), then the build method would not be
 | 
			
		||||
      // called again, and so nothing would appear to happen.
 | 
			
		||||
      _counter++;
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  Widget build(BuildContext context) {
 | 
			
		||||
    return Scaffold(
 | 
			
		||||
      appBar: AppBar(
 | 
			
		||||
        title: Text(widget.title),
 | 
			
		||||
      ),
 | 
			
		||||
      body: Center(
 | 
			
		||||
        child: Column(
 | 
			
		||||
          mainAxisAlignment: MainAxisAlignment.center,
 | 
			
		||||
          children: <Widget>[
 | 
			
		||||
            Text(
 | 
			
		||||
              'You have pushed the button this many times:',
 | 
			
		||||
            ),
 | 
			
		||||
            Text(
 | 
			
		||||
              '$_counter',
 | 
			
		||||
              style: Theme.of(context).textTheme.headline4,
 | 
			
		||||
            ),
 | 
			
		||||
          ],
 | 
			
		||||
        ),
 | 
			
		||||
      ),
 | 
			
		||||
      floatingActionButton: FloatingActionButton(
 | 
			
		||||
        onPressed: _incrementCounter,
 | 
			
		||||
        tooltip: 'Increment',
 | 
			
		||||
        child: Icon(Icons.add),
 | 
			
		||||
      ),
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@ -1,5 +0,0 @@
 | 
			
		||||
import 'package:flutter/services.dart';
 | 
			
		||||
import 'package:fast_rsa/model/bridge.pb.dart';
 | 
			
		||||
import 'package:fast_rsa/rsa.dart';
 | 
			
		||||
 | 
			
		||||
class Transaction {}
 | 
			
		||||
							
								
								
									
										25
									
								
								loc_chain_app/lib/util/transaction_manager.dart
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								loc_chain_app/lib/util/transaction_manager.dart
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,25 @@
 | 
			
		||||
import 'package:fast_rsa/model/bridge.pb.dart';
 | 
			
		||||
import 'package:shared_preferences/shared_preferences.dart';
 | 
			
		||||
import 'package:sqflite/sqflite.dart';
 | 
			
		||||
import 'package:fast_rsa/rsa.dart';
 | 
			
		||||
 | 
			
		||||
import 'dart:io';
 | 
			
		||||
 | 
			
		||||
class Transaction {
 | 
			
		||||
  Transaction({required this.otherUserID}) {
 | 
			
		||||
    SharedPreferences.getInstance().then((s) => _id = s.getString('id') ?? '0');
 | 
			
		||||
  }
 | 
			
		||||
  late final String _id;
 | 
			
		||||
  final String otherUserID;
 | 
			
		||||
  static Hash? makeTransactionHash() {}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class TransactionsDBManager {
 | 
			
		||||
  static Future<Database> get _localFile async {
 | 
			
		||||
    return openDatabase('transactions.db');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static Future<List<Transaction>?> readTransactions() async {}
 | 
			
		||||
 | 
			
		||||
  static Future<void> writeKeyPair(KeyPair pair) async {}
 | 
			
		||||
}
 | 
			
		||||
@ -191,6 +191,48 @@ packages:
 | 
			
		||||
      url: "https://pub.dartlang.org"
 | 
			
		||||
    source: hosted
 | 
			
		||||
    version: "2.0.0"
 | 
			
		||||
  shared_preferences:
 | 
			
		||||
    dependency: "direct main"
 | 
			
		||||
    description:
 | 
			
		||||
      name: shared_preferences
 | 
			
		||||
      url: "https://pub.dartlang.org"
 | 
			
		||||
    source: hosted
 | 
			
		||||
    version: "2.0.5"
 | 
			
		||||
  shared_preferences_linux:
 | 
			
		||||
    dependency: transitive
 | 
			
		||||
    description:
 | 
			
		||||
      name: shared_preferences_linux
 | 
			
		||||
      url: "https://pub.dartlang.org"
 | 
			
		||||
    source: hosted
 | 
			
		||||
    version: "2.0.0"
 | 
			
		||||
  shared_preferences_macos:
 | 
			
		||||
    dependency: transitive
 | 
			
		||||
    description:
 | 
			
		||||
      name: shared_preferences_macos
 | 
			
		||||
      url: "https://pub.dartlang.org"
 | 
			
		||||
    source: hosted
 | 
			
		||||
    version: "2.0.0"
 | 
			
		||||
  shared_preferences_platform_interface:
 | 
			
		||||
    dependency: transitive
 | 
			
		||||
    description:
 | 
			
		||||
      name: shared_preferences_platform_interface
 | 
			
		||||
      url: "https://pub.dartlang.org"
 | 
			
		||||
    source: hosted
 | 
			
		||||
    version: "2.0.0"
 | 
			
		||||
  shared_preferences_web:
 | 
			
		||||
    dependency: transitive
 | 
			
		||||
    description:
 | 
			
		||||
      name: shared_preferences_web
 | 
			
		||||
      url: "https://pub.dartlang.org"
 | 
			
		||||
    source: hosted
 | 
			
		||||
    version: "2.0.0"
 | 
			
		||||
  shared_preferences_windows:
 | 
			
		||||
    dependency: transitive
 | 
			
		||||
    description:
 | 
			
		||||
      name: shared_preferences_windows
 | 
			
		||||
      url: "https://pub.dartlang.org"
 | 
			
		||||
    source: hosted
 | 
			
		||||
    version: "2.0.0"
 | 
			
		||||
  sky_engine:
 | 
			
		||||
    dependency: transitive
 | 
			
		||||
    description: flutter
 | 
			
		||||
@ -203,6 +245,20 @@ packages:
 | 
			
		||||
      url: "https://pub.dartlang.org"
 | 
			
		||||
    source: hosted
 | 
			
		||||
    version: "1.8.0"
 | 
			
		||||
  sqflite:
 | 
			
		||||
    dependency: "direct main"
 | 
			
		||||
    description:
 | 
			
		||||
      name: sqflite
 | 
			
		||||
      url: "https://pub.dartlang.org"
 | 
			
		||||
    source: hosted
 | 
			
		||||
    version: "2.0.0+3"
 | 
			
		||||
  sqflite_common:
 | 
			
		||||
    dependency: transitive
 | 
			
		||||
    description:
 | 
			
		||||
      name: sqflite_common
 | 
			
		||||
      url: "https://pub.dartlang.org"
 | 
			
		||||
    source: hosted
 | 
			
		||||
    version: "2.0.0+2"
 | 
			
		||||
  stack_trace:
 | 
			
		||||
    dependency: transitive
 | 
			
		||||
    description:
 | 
			
		||||
@ -224,6 +280,13 @@ packages:
 | 
			
		||||
      url: "https://pub.dartlang.org"
 | 
			
		||||
    source: hosted
 | 
			
		||||
    version: "1.1.0"
 | 
			
		||||
  synchronized:
 | 
			
		||||
    dependency: transitive
 | 
			
		||||
    description:
 | 
			
		||||
      name: synchronized
 | 
			
		||||
      url: "https://pub.dartlang.org"
 | 
			
		||||
    source: hosted
 | 
			
		||||
    version: "3.0.0"
 | 
			
		||||
  term_glyph:
 | 
			
		||||
    dependency: transitive
 | 
			
		||||
    description:
 | 
			
		||||
@ -268,4 +331,4 @@ packages:
 | 
			
		||||
    version: "0.2.0"
 | 
			
		||||
sdks:
 | 
			
		||||
  dart: ">=2.12.0 <3.0.0"
 | 
			
		||||
  flutter: ">=1.20.0"
 | 
			
		||||
  flutter: ">=1.24.0-10"
 | 
			
		||||
 | 
			
		||||
@ -24,12 +24,13 @@ dependencies:
 | 
			
		||||
  flutter:
 | 
			
		||||
    sdk: flutter
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  # The following adds the Cupertino Icons font to your application.
 | 
			
		||||
  # Use with the CupertinoIcons class for iOS style icons.
 | 
			
		||||
  cupertino_icons: ^1.0.2
 | 
			
		||||
  path_provider: ^2.0.1
 | 
			
		||||
  fast_rsa: ^1.4.0-nullsafety.4
 | 
			
		||||
  shared_preferences: ^2.0.5
 | 
			
		||||
  sqflite: ^2.0.0+3
 | 
			
		||||
 | 
			
		||||
dev_dependencies:
 | 
			
		||||
  flutter_test:
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user