refactor(flutter_gui): moved constants to seperate file
This commit is contained in:
parent
f0f67332a0
commit
1b83c0b5ff
5 changed files with 46 additions and 45 deletions
7
flutter_test_gui/lib/consts/consts.dart
Normal file
7
flutter_test_gui/lib/consts/consts.dart
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class Constants {
|
||||
static const backColor = Color(0xFF32363E);
|
||||
static const highlightColor = Color(0xFF98C379);
|
||||
static const textColor = Color(0xFFABB2BF);
|
||||
}
|
||||
|
|
@ -79,7 +79,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||
centerTitle: true,
|
||||
title: Text(
|
||||
widget.title,
|
||||
style: TextStyle(color: textColor),
|
||||
style: const TextStyle(color: textColor),
|
||||
),
|
||||
actions: [
|
||||
PopupMenuButton<String>(
|
||||
|
|
|
|||
|
|
@ -6,10 +6,11 @@ import 'package:mobile_scanner/mobile_scanner.dart';
|
|||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:flutter_test_gui/src/rust/api/simple.dart';
|
||||
import 'package:flutter_test_gui/src/rust/frb_generated.dart';
|
||||
import 'package:flutter_test_gui/consts/consts.dart';
|
||||
|
||||
const backColor = Color(0xFF32363E);
|
||||
const highlightColor = Color(0xFF98C379);
|
||||
const textColor = Color(0xFFABB2BF);
|
||||
// const backColor = Color(0xFF32363E);
|
||||
// const highlightColor = Color(0xFF98C379);
|
||||
// const textColor = Color(0xFFABB2BF);
|
||||
|
||||
class ReceiveScreen extends StatefulWidget {
|
||||
@override
|
||||
|
|
@ -100,12 +101,12 @@ class _ReceiveScreenState extends State<ReceiveScreen> {
|
|||
height: 200,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: textColor,
|
||||
color: Constants.textColor,
|
||||
),
|
||||
child: const Center(
|
||||
child: Icon(
|
||||
Icons.qr_code,
|
||||
color: highlightColor,
|
||||
color: Constants.highlightColor,
|
||||
size: 100,
|
||||
),
|
||||
),
|
||||
|
|
@ -130,18 +131,18 @@ class _ReceiveScreenState extends State<ReceiveScreen> {
|
|||
controller: myController,
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(
|
||||
color: highlightColor,
|
||||
color: Constants.highlightColor,
|
||||
),
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Enter Transfername',
|
||||
alignLabelWithHint: true,
|
||||
floatingLabelAlignment: FloatingLabelAlignment.center,
|
||||
labelStyle: TextStyle(color: Colors.white54),
|
||||
labelStyle: TextStyle(color: Constants.textColor),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.white),
|
||||
borderSide: BorderSide(color: Constants.textColor),
|
||||
),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.white),
|
||||
borderSide: BorderSide(color: Constants.textColor),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
@ -150,8 +151,8 @@ class _ReceiveScreenState extends State<ReceiveScreen> {
|
|||
const SizedBox(height: 16),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: textColor,
|
||||
foregroundColor: highlightColor,
|
||||
backgroundColor: Constants.textColor,
|
||||
foregroundColor: Constants.highlightColor,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
|
|
@ -163,7 +164,7 @@ class _ReceiveScreenState extends State<ReceiveScreen> {
|
|||
),
|
||||
Text(
|
||||
greetingText,
|
||||
style: const TextStyle(color: Colors.white),
|
||||
style: const TextStyle(color: Constants.textColor),
|
||||
),
|
||||
],
|
||||
)),
|
||||
|
|
|
|||
|
|
@ -7,10 +7,11 @@ import 'package:file_picker/file_picker.dart';
|
|||
import 'package:flutter_test_gui/pages/waiting_screen.dart';
|
||||
import 'package:flutter_test_gui/src/rust/api/simple.dart';
|
||||
import 'package:flutter_test_gui/src/rust/frb_generated.dart';
|
||||
import 'package:flutter_test_gui/consts/consts.dart';
|
||||
|
||||
const backColor = Color(0xFF32363E);
|
||||
const highlightColor = Color(0xFF98C379);
|
||||
const textColor = Color(0xFFABB2BF);
|
||||
// const backColor = Color(0xFF32363E);
|
||||
// const highlightColor = Color(0xFF98C379);
|
||||
// const textColor = Color(0xFFABB2BF);
|
||||
|
||||
class SendScreen extends StatefulWidget {
|
||||
@override
|
||||
|
|
@ -47,7 +48,7 @@ class _SendScreenState extends State<SendScreen> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: backColor,
|
||||
backgroundColor: Constants.backColor,
|
||||
body: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
|
|
@ -77,35 +78,26 @@ class _SendScreenState extends State<SendScreen> {
|
|||
Container(
|
||||
height: 200,
|
||||
width: 200,
|
||||
decoration: BoxDecoration(
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: _dragging
|
||||
? Colors.blue.withOpacity(0.4)
|
||||
: textColor),
|
||||
child: _list.isEmpty
|
||||
color: Constants.textColor),
|
||||
child: _dragging
|
||||
? const Center(
|
||||
child: Icon(
|
||||
Icons.add_circle_outlined,
|
||||
color: highlightColor,
|
||||
Icons.add_rounded,
|
||||
color: Constants.highlightColor,
|
||||
size: 200,
|
||||
),
|
||||
)
|
||||
: Text(_list.join("\n")),
|
||||
: const Center(
|
||||
child: Icon(
|
||||
Icons.upload_rounded,
|
||||
color: Constants.highlightColor,
|
||||
size: 200,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
if (_list.isNotEmpty)
|
||||
SizedBox(
|
||||
height: 100,
|
||||
child: ListView.builder(
|
||||
itemCount: _list.length,
|
||||
itemBuilder: (context, index) {
|
||||
return Text(
|
||||
_list[index].name,
|
||||
style: const TextStyle(color: Colors.white),
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
@ -115,8 +107,8 @@ class _SendScreenState extends State<SendScreen> {
|
|||
),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: textColor,
|
||||
foregroundColor: highlightColor,
|
||||
backgroundColor: Constants.textColor,
|
||||
foregroundColor: Constants.highlightColor,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -6,10 +6,11 @@ import 'package:cross_file/cross_file.dart';
|
|||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:flutter_test_gui/src/rust/api/simple.dart';
|
||||
import 'package:flutter_test_gui/src/rust/frb_generated.dart';
|
||||
import 'package:flutter_test_gui/consts/consts.dart';
|
||||
|
||||
const backColor = Color(0xFF32363E);
|
||||
const highlightColor = Color(0xFF98C379);
|
||||
const textColor = Color(0xFFABB2BF);
|
||||
// const backColor = Color(0xFF32363E);
|
||||
// const highlightColor = Color(0xFF98C379);
|
||||
// const textColor = Color(0xFFABB2BF);
|
||||
|
||||
class WaitingScreen extends StatefulWidget {
|
||||
final List<XFile> files;
|
||||
|
|
@ -54,7 +55,7 @@ class _WaitingScreenState extends State<WaitingScreen> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: backColor,
|
||||
backgroundColor: Constants.backColor,
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
|
|
@ -68,7 +69,7 @@ class _WaitingScreenState extends State<WaitingScreen> {
|
|||
data: widget.transferName,
|
||||
version: QrVersions.auto,
|
||||
size: 200,
|
||||
foregroundColor: highlightColor,
|
||||
foregroundColor: Constants.highlightColor,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue