wd history done, closes #6
This commit is contained in:
parent
eee0993973
commit
21d543ca1c
|
|
@ -262,4 +262,17 @@ class DataManager{
|
|||
return (response.body.toString());
|
||||
}
|
||||
|
||||
|
||||
static Future<List<dynamic>> GetWithdrawalHistory() async{
|
||||
Map<String,String> body = <String, String>{
|
||||
"id": UserJson['id']
|
||||
};
|
||||
var response = (await http.post(
|
||||
Uri.parse('${API_ENDPOINT}get_wd_history.php'),
|
||||
body: body));
|
||||
Debug.Log("wd history response: " +response.body.toString());
|
||||
|
||||
return jsonDecode(response.body.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ import 'package:fhub/backend/DebugHelper.dart';
|
|||
import 'package:fhub/backend/Dialogs.dart';
|
||||
import 'package:fhub/gameInfo.dart';
|
||||
import 'package:fhub/src/CustomWidgets.dart';
|
||||
import 'package:fhub/wd_history.dart';
|
||||
import 'package:fhub/wd_portal.dart';
|
||||
import 'package:fhub/welcome.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
|
@ -404,7 +405,11 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
|
|||
builder: (BuildContext context) =>
|
||||
WithdrawalPortal()));
|
||||
}, child: Text("Withdraw"),height: 40, width: 200, color: Colors.greenAccent),
|
||||
GlassButton(onTap: (){}, child: Icon(Icons.history), width: 60, height: 40)
|
||||
GlassButton(onTap: (){
|
||||
Navigator.of(context).push(MaterialPageRoute(
|
||||
builder: (BuildContext context) =>
|
||||
WithdrawalHistoryPage()));
|
||||
}, child: Icon(Icons.history), width: 60, height: 40)
|
||||
],
|
||||
)
|
||||
],
|
||||
|
|
|
|||
168
lib/wd_history.dart
Normal file
168
lib/wd_history.dart
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
import 'package:fhub/backend/DataManager.dart';
|
||||
import 'package:fhub/backend/helpers.dart';
|
||||
import 'package:fhub/src/CustomWidgets.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class WithdrawalHistoryPage extends StatefulWidget {
|
||||
const WithdrawalHistoryPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<WithdrawalHistoryPage> createState() => _WithdrawalHistoryPageState();
|
||||
}
|
||||
|
||||
class _WithdrawalHistoryPageState extends State<WithdrawalHistoryPage> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
|
||||
kickstartAnimations();
|
||||
GetHistory();
|
||||
}
|
||||
List<dynamic> wd_requests = [];
|
||||
void GetHistory() async{
|
||||
wd_requests = await DataManager.GetWithdrawalHistory();
|
||||
|
||||
loaded =true;
|
||||
setState(() {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
void kickstartAnimations() async {
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
|
||||
setState(() {
|
||||
op1 = 0.5;
|
||||
op2 = 0.5;
|
||||
op3 = 0.5;
|
||||
});
|
||||
}
|
||||
bool loaded = false;
|
||||
ScrollController scrollController = ScrollController();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final screenHeight = MediaQuery.of(context).size.height;
|
||||
final screenWidth = MediaQuery.of(context).size.width;
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.black,
|
||||
body: CustomBody(
|
||||
child: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
InkWell(
|
||||
child: Container(
|
||||
margin: EdgeInsets.all(10),
|
||||
child: Icon(Icons.keyboard_arrow_left,
|
||||
size: 50)),
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
GradientText(
|
||||
text: "Withdrawal History",
|
||||
gradient: LinearGradient(colors: [
|
||||
Colors.white.withOpacity(0.6),
|
||||
Colors.white.withOpacity(0.5),
|
||||
Colors.white.withOpacity(0.2)
|
||||
]),
|
||||
style: TextStyle(
|
||||
fontSize: 29,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
Container(
|
||||
width: 40,
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 50,
|
||||
),
|
||||
(loaded) ?
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: GlassCard(child: Container(
|
||||
|
||||
height: screenHeight * 0.6,
|
||||
padding: EdgeInsets.all(12),
|
||||
child: Column(
|
||||
children: [
|
||||
ListView.builder(
|
||||
shrinkWrap: true,
|
||||
controller: scrollController,
|
||||
itemCount: wd_requests.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return WdRequestItem(
|
||||
wd_requests[index]);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
)
|
||||
:Container(height: screenHeight * 0.6,child: Center(child: Text("Loading...")))
|
||||
|
||||
],
|
||||
)
|
||||
]))),
|
||||
context: context,
|
||||
onAnimEnd: () {
|
||||
kickstartAnimations();
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
Widget WdRequestItem(dynamic request) {
|
||||
DateTime createdTime = DateTime.parse(request['created_time']);
|
||||
return InkWell(
|
||||
onTap: (){
|
||||
if((request['receipt'].toString() ?? "").contains("http")){
|
||||
launchUrl(Uri.parse(request['receipt']));
|
||||
}
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(3.0),
|
||||
child: GlassCard(
|
||||
color: Colors.white,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 10),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [SizedBox(width: 100, child: Text(DateFormat('yyyy-MM-dd').format(createdTime)))],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
"${Helpers.SatsToCoin(int.parse(request['amount'])).toStringAsFixed(8)}"),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Icon(Helpers.GetIconForCrypto(request['coin']))
|
||||
],
|
||||
),
|
||||
Text(request['status'])
|
||||
],
|
||||
),
|
||||
),
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -6,6 +6,10 @@
|
|||
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <url_launcher_linux/url_launcher_plugin.h>
|
||||
|
||||
void fl_register_plugins(FlPluginRegistry* registry) {
|
||||
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
|
||||
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#
|
||||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
url_launcher_linux
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
|
|
|
|||
|
|
@ -8,9 +8,11 @@ import Foundation
|
|||
import firebase_auth
|
||||
import firebase_core
|
||||
import shared_preferences_foundation
|
||||
import url_launcher_macos
|
||||
|
||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin"))
|
||||
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
|
||||
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
||||
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
|
||||
}
|
||||
|
|
|
|||
72
pubspec.lock
72
pubspec.lock
|
|
@ -248,6 +248,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.0.2"
|
||||
intl:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: intl
|
||||
sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.18.1"
|
||||
js:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -469,6 +477,70 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.2"
|
||||
url_launcher:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: url_launcher
|
||||
sha256: eb1e00ab44303d50dd487aab67ebc575456c146c6af44422f9c13889984c00f3
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.1.11"
|
||||
url_launcher_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_android
|
||||
sha256: "15f5acbf0dce90146a0f5a2c4a002b1814a6303c4c5c075aa2623b2d16156f03"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.0.36"
|
||||
url_launcher_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_ios
|
||||
sha256: "9af7ea73259886b92199f9e42c116072f05ff9bea2dcb339ab935dfc957392c2"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.1.4"
|
||||
url_launcher_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_linux
|
||||
sha256: "207f4ddda99b95b4d4868320a352d374b0b7e05eefad95a4a26f57da413443f5"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.5"
|
||||
url_launcher_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_macos
|
||||
sha256: "91ee3e75ea9dadf38036200c5d3743518f4a5eb77a8d13fda1ee5764373f185e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.5"
|
||||
url_launcher_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_platform_interface
|
||||
sha256: bfdfa402f1f3298637d71ca8ecfe840b4696698213d5346e9d12d4ab647ee2ea
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.3"
|
||||
url_launcher_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_web
|
||||
sha256: "6bb1e5d7fe53daf02a8fee85352432a40b1f868a81880e99ec7440113d5cfcab"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.17"
|
||||
url_launcher_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_windows
|
||||
sha256: "254708f17f7c20a9c8c471f67d86d76d4a3f9c1591aad1e15292008aceb82771"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.6"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ dependencies:
|
|||
animated_text_kit: ^4.2.2
|
||||
cupertino_icons: ^1.0.2
|
||||
external_app_launcher: ^3.1.0
|
||||
url_launcher: ^6.1.11
|
||||
intl: ^0.18.1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
|
|
|||
|
|
@ -7,8 +7,11 @@
|
|||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <firebase_core/firebase_core_plugin_c_api.h>
|
||||
#include <url_launcher_windows/url_launcher_windows.h>
|
||||
|
||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||
FirebaseCorePluginCApiRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("FirebaseCorePluginCApi"));
|
||||
UrlLauncherWindowsRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
firebase_core
|
||||
url_launcher_windows
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user