rm dep. dropdownbtn
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 32 KiB |
@@ -10,8 +10,6 @@ import 'package:toolbox/view/widget/card_dialog.dart';
|
|||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
import 'package:toolbox/core/extension/stringx.dart';
|
import 'package:toolbox/core/extension/stringx.dart';
|
||||||
|
|
||||||
void unawaited(Future<void> future) {}
|
|
||||||
|
|
||||||
bool isDarkMode(BuildContext context) =>
|
bool isDarkMode(BuildContext context) =>
|
||||||
Theme.of(context).brightness == Brightness.dark;
|
Theme.of(context).brightness == Brightness.dark;
|
||||||
|
|
||||||
@@ -110,3 +108,19 @@ Future<bool> shareFiles(BuildContext context, List<String> filePaths) async {
|
|||||||
await Share.shareFiles(filePaths, text: 'ServerBox -> $text');
|
await Share.shareFiles(filePaths, text: 'ServerBox -> $text');
|
||||||
return filePaths.isNotEmpty;
|
return filePaths.isNotEmpty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget buildPopuopMenu(
|
||||||
|
{required List<PopupMenuEntry> items,
|
||||||
|
required Function(dynamic) onSelected}) {
|
||||||
|
return PopupMenuButton(
|
||||||
|
itemBuilder: (_) => items,
|
||||||
|
onSelected: onSelected,
|
||||||
|
child: const Padding(
|
||||||
|
padding: EdgeInsets.only(left: 7),
|
||||||
|
child: Icon(
|
||||||
|
Icons.more_vert,
|
||||||
|
size: 23,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:dropdown_button2/dropdown_button2.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:toolbox/core/utils.dart';
|
import 'package:toolbox/core/utils.dart';
|
||||||
@@ -152,27 +151,18 @@ class _DockerManagePageState extends State<DockerManagePage> {
|
|||||||
|
|
||||||
Widget _buildMoreBtn(bool running, String containerId) {
|
Widget _buildMoreBtn(bool running, String containerId) {
|
||||||
final item = running ? DockerMenuItems.stop : DockerMenuItems.start;
|
final item = running ? DockerMenuItems.stop : DockerMenuItems.start;
|
||||||
return DropdownButtonHideUnderline(
|
return buildPopuopMenu(
|
||||||
child: DropdownButton2(
|
|
||||||
customButton: const Padding(
|
|
||||||
padding: EdgeInsets.only(left: 7),
|
|
||||||
child: Icon(
|
|
||||||
Icons.more_vert,
|
|
||||||
size: 17,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
customItemsHeight: 8,
|
|
||||||
items: [
|
items: [
|
||||||
DropdownMenuItem<DropdownBtnItem>(
|
PopupMenuItem<DropdownBtnItem>(
|
||||||
value: item,
|
value: item,
|
||||||
child: item.build,
|
child: item.build,
|
||||||
),
|
),
|
||||||
DropdownMenuItem<DropdownBtnItem>(
|
PopupMenuItem<DropdownBtnItem>(
|
||||||
value: DockerMenuItems.rm,
|
value: DockerMenuItems.rm,
|
||||||
child: DockerMenuItems.rm.build,
|
child: DockerMenuItems.rm.build,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
onChanged: (value) {
|
onSelected: (value) {
|
||||||
final item = value as DropdownBtnItem;
|
final item = value as DropdownBtnItem;
|
||||||
switch (item) {
|
switch (item) {
|
||||||
case DockerMenuItems.rm:
|
case DockerMenuItems.rm:
|
||||||
@@ -186,15 +176,6 @@ class _DockerManagePageState extends State<DockerManagePage> {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
itemHeight: 37,
|
|
||||||
itemPadding: const EdgeInsets.only(left: 17, right: 17),
|
|
||||||
dropdownWidth: 133,
|
|
||||||
dropdownDecoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(7),
|
|
||||||
),
|
|
||||||
dropdownElevation: 8,
|
|
||||||
offset: const Offset(0, 8),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'package:after_layout/after_layout.dart';
|
import 'package:after_layout/after_layout.dart';
|
||||||
import 'package:circle_chart/circle_chart.dart';
|
import 'package:circle_chart/circle_chart.dart';
|
||||||
import 'package:dropdown_button2/dropdown_button2.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get_it/get_it.dart';
|
import 'package:get_it/get_it.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
@@ -200,72 +199,42 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildMoreBtn(ServerPrivateInfo spi) {
|
Widget _buildMoreBtn(ServerPrivateInfo spi) {
|
||||||
return DropdownButtonHideUnderline(
|
return buildPopuopMenu(
|
||||||
child: DropdownButton2(
|
items: <PopupMenuEntry>[
|
||||||
customButton: const Padding(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 5, vertical: 1.7),
|
|
||||||
child: Icon(
|
|
||||||
Icons.more_vert,
|
|
||||||
size: 17,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
customItemsIndexes: [ServerTabMenuItems.firstItems.length],
|
|
||||||
customItemsHeight: 8,
|
|
||||||
items: [
|
|
||||||
...ServerTabMenuItems.firstItems.map(
|
...ServerTabMenuItems.firstItems.map(
|
||||||
(item) => DropdownMenuItem<DropdownBtnItem>(
|
(item) => PopupMenuItem<DropdownBtnItem>(
|
||||||
value: item,
|
value: item,
|
||||||
child: item.build,
|
child: item.build,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const DropdownMenuItem<Divider>(enabled: false, child: Divider()),
|
const PopupMenuDivider(height: 1),
|
||||||
...ServerTabMenuItems.secondItems.map(
|
...ServerTabMenuItems.secondItems.map(
|
||||||
(item) => DropdownMenuItem<DropdownBtnItem>(
|
(item) => PopupMenuItem<DropdownBtnItem>(
|
||||||
value: item,
|
value: item,
|
||||||
child: item.build,
|
child: item.build,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
onChanged: (value) {
|
onSelected: (value) {
|
||||||
final item = value as DropdownBtnItem;
|
final item = value as DropdownBtnItem;
|
||||||
switch (item) {
|
switch (item) {
|
||||||
case ServerTabMenuItems.apt:
|
case ServerTabMenuItems.apt:
|
||||||
AppRoute(AptManagePage(spi), 'apt manage page').go(context);
|
AppRoute(AptManagePage(spi), 'apt manage').go(context);
|
||||||
break;
|
break;
|
||||||
case ServerTabMenuItems.sftp:
|
case ServerTabMenuItems.sftp:
|
||||||
AppRoute(SFTPPage(spi), 'SFTP').go(context);
|
AppRoute(SFTPPage(spi), 'SFTP').go(context);
|
||||||
break;
|
break;
|
||||||
case ServerTabMenuItems.snippet:
|
case ServerTabMenuItems.snippet:
|
||||||
AppRoute(
|
AppRoute(SnippetListPage(spi: spi), 'snippet list').go(context);
|
||||||
SnippetListPage(
|
|
||||||
spi: spi,
|
|
||||||
),
|
|
||||||
'snippet list')
|
|
||||||
.go(context);
|
|
||||||
break;
|
break;
|
||||||
case ServerTabMenuItems.edit:
|
case ServerTabMenuItems.edit:
|
||||||
AppRoute(
|
AppRoute(ServerEditPage(spi: spi), 'Edit server info').go(context);
|
||||||
ServerEditPage(
|
|
||||||
spi: spi,
|
|
||||||
),
|
|
||||||
'Edit server info page')
|
|
||||||
.go(context);
|
|
||||||
break;
|
break;
|
||||||
case ServerTabMenuItems.docker:
|
case ServerTabMenuItems.docker:
|
||||||
AppRoute(DockerManagePage(spi), 'Docker manage page').go(context);
|
AppRoute(DockerManagePage(spi), 'Docker manage').go(context);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
itemHeight: 37,
|
|
||||||
itemPadding: const EdgeInsets.only(left: 17, right: 17),
|
|
||||||
dropdownWidth: 160,
|
|
||||||
dropdownPadding: const EdgeInsets.symmetric(vertical: 7),
|
|
||||||
dropdownDecoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(7),
|
|
||||||
),
|
|
||||||
dropdownElevation: 8,
|
|
||||||
offset: const Offset(0, 8),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -208,13 +208,6 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.0.6"
|
version: "4.0.6"
|
||||||
dropdown_button2:
|
|
||||||
dependency: "direct main"
|
|
||||||
description:
|
|
||||||
name: dropdown_button2
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "1.5.2"
|
|
||||||
easy_isolate:
|
easy_isolate:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ dependencies:
|
|||||||
ref: main
|
ref: main
|
||||||
# path: ../circle_chart
|
# path: ../circle_chart
|
||||||
r_upgrade: ^0.3.6
|
r_upgrade: ^0.3.6
|
||||||
dropdown_button2: ^1.1.1
|
|
||||||
flutter_advanced_drawer: ^1.3.0
|
flutter_advanced_drawer: ^1.3.0
|
||||||
path_provider: ^2.0.9
|
path_provider: ^2.0.9
|
||||||
easy_isolate: ^1.3.0
|
easy_isolate: ^1.3.0
|
||||||
|
|||||||
Reference in New Issue
Block a user