From 00b81d530ec027b73777276aee86675c62741b74 Mon Sep 17 00:00:00 2001 From: poka Date: Wed, 15 Mar 2023 18:24:10 +0100 Subject: [PATCH] feat: add debug screen --- lib/screens/debug_screen.dart | 62 +++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 lib/screens/debug_screen.dart diff --git a/lib/screens/debug_screen.dart b/lib/screens/debug_screen.dart new file mode 100644 index 0000000..4dbe27f --- /dev/null +++ b/lib/screens/debug_screen.dart @@ -0,0 +1,62 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:gecko/globals.dart'; +import 'package:flutter/material.dart'; +import 'package:gecko/providers/substrate_sdk.dart'; +import 'package:provider/provider.dart'; + +class DebugScreen extends StatelessWidget { + const DebugScreen({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + final sub = Provider.of(context); + + return Scaffold( + backgroundColor: backgroundColor, + appBar: AppBar( + toolbarHeight: 60 * ratio, + title: const SizedBox( + height: 22, + child: Text('Debug screen'), + )), + body: SafeArea( + child: Column(children: [ + const SizedBox(height: 40), + Center( + child: Column( + children: [ + Text( + 'node: ${sub.getConnectedEndpoint()}', + style: TextStyle(fontSize: 15, color: Colors.grey[700]), + ), + const SizedBox(height: 15), + Text( + 'blockN'.tr(args: [ + sub.blocNumber.toString() + ]), //'bloc N°${sub.blocNumber}', + style: TextStyle(fontSize: 15, color: Colors.grey[700]), + ), + const SizedBox(height: 20), + SizedBox( + height: 60, + width: 250, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + foregroundColor: Colors.white, elevation: 4, + backgroundColor: orangeC, // foreground + ), + onPressed: () async => await sub.spawnBlock(), + child: const Text( + 'Spawn a bloc', + style: TextStyle( + fontSize: 20, fontWeight: FontWeight.w600), + ), + ), + ), + ], + ), + ), + ]), + )); + } +}