mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-14 20:33:41 +00:00
feat: support custom tracker url (#59)
This commit is contained in:
1 parent
9ef3405e43
commit
691c2f496e
71 files changed
+2209
-891
No files matched your search
@@ -0,0 +1,71 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class CheckListView extends StatefulWidget {
|
||||
final List<String> items;
|
||||
final List<String> checked;
|
||||
final void Function(List<String> value) onChanged;
|
||||
|
||||
const CheckListView({
|
||||
Key? key,
|
||||
required this.items,
|
||||
required this.checked,
|
||||
required this.onChanged,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<CheckListView> createState() => _CheckListView();
|
||||
}
|
||||
|
||||
class _CheckListView extends State<CheckListView> {
|
||||
bool get _allChecked => _checked.length == _items.length;
|
||||
|
||||
List<String> get _checked => widget.checked;
|
||||
|
||||
List<String> get _items => widget.items;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(top: 10),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.grey, width: 1),
|
||||
borderRadius: BorderRadius.circular(5)),
|
||||
child: Column(
|
||||
children: [
|
||||
CheckboxListTile(
|
||||
value: _allChecked,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_checked.clear();
|
||||
if (value!) {
|
||||
_checked.addAll(_items);
|
||||
}
|
||||
widget.onChanged(_checked);
|
||||
});
|
||||
},
|
||||
title: Text('selectAll'.tr),
|
||||
),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: _items.length,
|
||||
itemBuilder: (context, index) {
|
||||
var item = _items[index];
|
||||
return CheckboxListTile(
|
||||
value: _checked.contains(item),
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_checked.contains(item)
|
||||
? _checked.remove(item)
|
||||
: _checked.add(item);
|
||||
widget.onChanged(_checked);
|
||||
});
|
||||
},
|
||||
title: Text(item),
|
||||
);
|
||||
}),
|
||||
),
|
||||
],
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
import 'package:file_selector/file_selector.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:gopeed/util/util.dart';
|
||||
|
||||
import '../util/mac_secure_util.dart';
|
||||
import '../util/util.dart';
|
||||
|
||||
class DirectorySelector extends StatefulWidget {
|
||||
final TextEditingController controller;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../util/util.dart';
|
||||
|
||||
import '../api/model/resource.dart';
|
||||
import '../util/util.dart';
|
||||
|
||||
class FileListView extends StatefulWidget {
|
||||
final List<FileInfo> files;
|
||||
@@ -30,7 +30,7 @@ class _FileListViewState extends State<FileListView> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Padding(padding: EdgeInsets.only(top: 10)),
|
||||
Text('create.selectDir'.tr,
|
||||
Text('create.selectFile'.tr,
|
||||
style: TextStyle(color: themeData.hintColor)),
|
||||
Expanded(
|
||||
child: Container(
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class OutlinedButtonLoading extends StatefulWidget {
|
||||
final Widget child;
|
||||
final VoidCallback onPressed;
|
||||
final OutlinedButtonLoadingController controller;
|
||||
|
||||
const OutlinedButtonLoading(
|
||||
{super.key,
|
||||
required this.child,
|
||||
required this.onPressed,
|
||||
required this.controller});
|
||||
|
||||
@override
|
||||
State<OutlinedButtonLoading> createState() => _OutlinedButtonLoadingState();
|
||||
}
|
||||
|
||||
class _OutlinedButtonLoadingState extends State<OutlinedButtonLoading> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ValueListenableBuilder<bool>(
|
||||
valueListenable: widget.controller,
|
||||
builder: (context, value, child) {
|
||||
return OutlinedButton(
|
||||
key: widget.key,
|
||||
onPressed: value ? null : widget.onPressed,
|
||||
child: value
|
||||
? const SizedBox(
|
||||
height: 20,
|
||||
width: 20,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
),
|
||||
)
|
||||
: widget.child,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class OutlinedButtonLoadingController extends ValueNotifier<bool> {
|
||||
OutlinedButtonLoadingController() : super(false);
|
||||
|
||||
void start() {
|
||||
value = true;
|
||||
}
|
||||
|
||||
void stop() {
|
||||
value = false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user