mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2026-02-23 08:34:39 +01:00
Completely apply theme to app
This commit is contained in:
@@ -2,6 +2,7 @@ import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
|
||||
import 'package:toolbox/data/res/color.dart';
|
||||
|
||||
class ConvertPage extends StatefulWidget {
|
||||
const ConvertPage({Key? key}) : super(key: key);
|
||||
@@ -103,6 +104,8 @@ class _ConvertPageState extends State<ConvertPage>
|
||||
return Card(
|
||||
child: ExpansionTile(
|
||||
leading: TextButton(
|
||||
style: ButtonStyle(
|
||||
foregroundColor: MaterialStateProperty.all(primaryColor)),
|
||||
child: SizedBox(
|
||||
width: _media.size.width * 0.3,
|
||||
child: Row(
|
||||
@@ -115,11 +118,15 @@ class _ConvertPageState extends State<ConvertPage>
|
||||
_textEditingControllerResult.text = temp;
|
||||
},
|
||||
),
|
||||
title: SizedBox(
|
||||
title: const SizedBox(),
|
||||
trailing: SizedBox(
|
||||
width: _media.size.width * 0.4,
|
||||
child: Text(
|
||||
_typeOption[_typeOptionIndex],
|
||||
style: const TextStyle(fontSize: 16.0, fontWeight: FontWeight.w500),
|
||||
style: TextStyle(
|
||||
fontSize: 16.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: primaryColor),
|
||||
),
|
||||
),
|
||||
children: _typeOption
|
||||
|
||||
@@ -102,18 +102,7 @@ class _MyHomePageState extends State<MyHomePage>
|
||||
Widget _buildIcon() {
|
||||
return ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxHeight: 60, maxWidth: 60),
|
||||
child: Stack(
|
||||
children: [
|
||||
Center(
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
height: 37,
|
||||
width: 37,
|
||||
),
|
||||
),
|
||||
Image.asset('assets/app_icon.jpg'),
|
||||
],
|
||||
),
|
||||
child: Image.asset('assets/app_icon.jpg'),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:toolbox/data/model/private_key_info.dart';
|
||||
import 'package:toolbox/data/provider/private_key.dart';
|
||||
import 'package:toolbox/locator.dart';
|
||||
import 'package:toolbox/view/widget/input_decoration.dart';
|
||||
|
||||
class PrivateKeyEditPage extends StatefulWidget {
|
||||
const PrivateKeyEditPage({Key? key, this.info}) : super(key: key);
|
||||
@@ -46,7 +47,7 @@ class _PrivateKeyEditPageState extends State<PrivateKeyEditPage>
|
||||
TextField(
|
||||
controller: nameController,
|
||||
keyboardType: TextInputType.text,
|
||||
decoration: _buildDecoration('Name', icon: Icons.info),
|
||||
decoration: buildDecoration('Name', icon: Icons.info),
|
||||
),
|
||||
TextField(
|
||||
controller: keyController,
|
||||
@@ -54,14 +55,14 @@ class _PrivateKeyEditPageState extends State<PrivateKeyEditPage>
|
||||
minLines: 3,
|
||||
maxLines: 10,
|
||||
keyboardType: TextInputType.text,
|
||||
decoration: _buildDecoration('Private Key', icon: Icons.vpn_key),
|
||||
decoration: buildDecoration('Private Key', icon: Icons.vpn_key),
|
||||
),
|
||||
TextField(
|
||||
controller: pwdController,
|
||||
autocorrect: false,
|
||||
keyboardType: TextInputType.text,
|
||||
obscureText: true,
|
||||
decoration: _buildDecoration('Password', icon: Icons.password),
|
||||
decoration: buildDecoration('Password', icon: Icons.password),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -81,12 +82,6 @@ class _PrivateKeyEditPageState extends State<PrivateKeyEditPage>
|
||||
);
|
||||
}
|
||||
|
||||
InputDecoration _buildDecoration(String label,
|
||||
{TextStyle? textStyle, IconData? icon}) {
|
||||
return InputDecoration(
|
||||
labelText: label, labelStyle: textStyle, icon: Icon(icon));
|
||||
}
|
||||
|
||||
@override
|
||||
void afterFirstLayout(BuildContext context) {
|
||||
if (widget.info != null) {
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:toolbox/core/route.dart';
|
||||
import 'package:toolbox/data/provider/private_key.dart';
|
||||
import 'package:toolbox/data/res/color.dart';
|
||||
import 'package:toolbox/view/page/private_key/edit.dart';
|
||||
import 'package:toolbox/view/widget/round_rect_card.dart';
|
||||
|
||||
@@ -13,6 +14,7 @@ class StoredPrivateKeysPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _PrivateKeyListState extends State<StoredPrivateKeysPage> {
|
||||
final _textStyle = TextStyle(color: primaryColor);
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -40,7 +42,10 @@ class _PrivateKeyListState extends State<StoredPrivateKeysPage> {
|
||||
PrivateKeyEditPage(info: key.infos[idx]),
|
||||
'private key edit page')
|
||||
.go(context),
|
||||
child: const Text('Edit'))
|
||||
child: Text(
|
||||
'Edit',
|
||||
style: _textStyle,
|
||||
))
|
||||
],
|
||||
));
|
||||
})
|
||||
|
||||
@@ -8,6 +8,7 @@ import 'package:toolbox/data/provider/private_key.dart';
|
||||
import 'package:toolbox/data/provider/server.dart';
|
||||
import 'package:toolbox/locator.dart';
|
||||
import 'package:toolbox/view/page/private_key/edit.dart';
|
||||
import 'package:toolbox/view/widget/input_decoration.dart';
|
||||
|
||||
class ServerEditPage extends StatefulWidget {
|
||||
const ServerEditPage({Key? key, this.spi}) : super(key: key);
|
||||
@@ -61,25 +62,25 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
||||
TextField(
|
||||
controller: nameController,
|
||||
keyboardType: TextInputType.text,
|
||||
decoration: _buildDecoration('Name', icon: Icons.info),
|
||||
decoration: buildDecoration('Name', icon: Icons.info),
|
||||
),
|
||||
TextField(
|
||||
controller: ipController,
|
||||
keyboardType: TextInputType.text,
|
||||
autocorrect: false,
|
||||
decoration: _buildDecoration('Host', icon: Icons.storage),
|
||||
decoration: buildDecoration('Host', icon: Icons.storage),
|
||||
),
|
||||
TextField(
|
||||
controller: portController,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration:
|
||||
_buildDecoration('Port', icon: Icons.format_list_numbered),
|
||||
buildDecoration('Port', icon: Icons.format_list_numbered),
|
||||
),
|
||||
TextField(
|
||||
controller: usernameController,
|
||||
keyboardType: TextInputType.text,
|
||||
autocorrect: false,
|
||||
decoration: _buildDecoration('User', icon: Icons.account_box),
|
||||
decoration: buildDecoration('User', icon: Icons.account_box),
|
||||
),
|
||||
const SizedBox(height: 7),
|
||||
Row(
|
||||
@@ -95,7 +96,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
||||
controller: passwordController,
|
||||
obscureText: true,
|
||||
keyboardType: TextInputType.text,
|
||||
decoration: _buildDecoration('Pwd', icon: Icons.password),
|
||||
decoration: buildDecoration('Pwd', icon: Icons.password),
|
||||
onSubmitted: (_) => {},
|
||||
)
|
||||
: const SizedBox(),
|
||||
|
||||
13
lib/view/widget/input_decoration.dart
Normal file
13
lib/view/widget/input_decoration.dart
Normal file
@@ -0,0 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:toolbox/data/res/color.dart';
|
||||
|
||||
InputDecoration buildDecoration(String label,
|
||||
{TextStyle? textStyle, IconData? icon}) {
|
||||
return InputDecoration(
|
||||
labelText: label,
|
||||
labelStyle: textStyle,
|
||||
icon: Icon(
|
||||
icon,
|
||||
color: primaryColor,
|
||||
));
|
||||
}
|
||||
Reference in New Issue
Block a user