mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
opt. & fix
This commit is contained in:
@@ -244,13 +244,10 @@ class _SettingPageState extends State<SettingPage> {
|
||||
Widget _buildAppColor() {
|
||||
return ListTile(
|
||||
trailing: ClipOval(
|
||||
child: ValueListenableBuilder(
|
||||
valueListenable: _setting.primaryColor.listenable(),
|
||||
builder: (_, val, __) => Container(
|
||||
color: Color(val),
|
||||
height: 27,
|
||||
width: 27,
|
||||
),
|
||||
child: Container(
|
||||
color: primaryColor,
|
||||
height: 27,
|
||||
width: 27,
|
||||
),
|
||||
),
|
||||
title: Text(l10n.primaryColorSeed),
|
||||
@@ -279,7 +276,7 @@ class _SettingPageState extends State<SettingPage> {
|
||||
icon: Icons.colorize,
|
||||
),
|
||||
ColorPicker(
|
||||
color: primaryColor,
|
||||
color: Color(_setting.primaryColor.fetch()),
|
||||
onColorChanged: (c) => ctrl.text = c.toHex,
|
||||
)
|
||||
]);
|
||||
@@ -311,6 +308,7 @@ class _SettingPageState extends State<SettingPage> {
|
||||
primaryColor = color;
|
||||
_setting.primaryColor.put(color.value);
|
||||
context.pop();
|
||||
context.pop();
|
||||
RebuildNodes.app.rebuild();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:provider/provider.dart';
|
||||
import 'package:toolbox/core/extension/context/common.dart';
|
||||
import 'package:toolbox/core/extension/context/dialog.dart';
|
||||
import 'package:toolbox/core/extension/context/locale.dart';
|
||||
import 'package:toolbox/core/route.dart';
|
||||
import 'package:toolbox/data/provider/server.dart';
|
||||
import 'package:toolbox/data/res/provider.dart';
|
||||
import 'package:toolbox/data/res/ui.dart';
|
||||
@@ -25,6 +26,7 @@ class _SSHTabPageState extends State<SSHTabPage>
|
||||
length: _tabIds.length,
|
||||
vsync: this,
|
||||
);
|
||||
final _fabRN = ValueNotifier(0);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -36,8 +38,21 @@ class _SSHTabPageState extends State<SSHTabPage>
|
||||
isScrollable: true,
|
||||
tabAlignment: TabAlignment.start,
|
||||
dividerColor: Colors.transparent,
|
||||
onTap: (value) => _fabRN.value = value,
|
||||
),
|
||||
body: _buildBody(),
|
||||
floatingActionButton: ListenableBuilder(
|
||||
listenable: _fabRN,
|
||||
builder: (_, __) {
|
||||
if (_fabRN.value == 0) return const SizedBox();
|
||||
return FloatingActionButton(
|
||||
onPressed: () => AppRoute.serverEdit().go(context),
|
||||
tooltip: l10n.addAServer,
|
||||
heroTag: 'server',
|
||||
child: const Icon(Icons.add),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -83,6 +98,14 @@ class _SSHTabPageState extends State<SSHTabPage>
|
||||
Widget _buildAddPage() {
|
||||
return Center(
|
||||
child: Consumer<ServerProvider>(builder: (_, pro, __) {
|
||||
if (pro.serverOrder.isEmpty) {
|
||||
return Center(
|
||||
child: Text(
|
||||
l10n.serverTabEmpty,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
);
|
||||
}
|
||||
return ListView.builder(
|
||||
padding: const EdgeInsets.all(7),
|
||||
itemBuilder: (_, idx) {
|
||||
|
||||
@@ -15,14 +15,13 @@ class ChoiceChipX<T> extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(3),
|
||||
child: ChoiceChip(
|
||||
return ChoiceChip(
|
||||
label: Text(label),
|
||||
side: BorderSide.none,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 1),
|
||||
labelPadding: const EdgeInsets.symmetric(horizontal: 5),
|
||||
selected: state.selected(value),
|
||||
onSelected: state.onSelected(value),
|
||||
),
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user