2021-11-04 05:56:25 +00:00
|
|
|
/// 多线程下载并发数
|
|
|
|
|
2021-10-31 06:01:19 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2021-11-11 03:00:38 +00:00
|
|
|
import 'package:pikapika/basic/Common.dart';
|
|
|
|
import 'package:pikapika/basic/Method.dart';
|
2021-10-31 06:01:19 +00:00
|
|
|
|
|
|
|
late int _downloadThreadCount;
|
|
|
|
const _values = [1, 2, 3, 4, 5];
|
|
|
|
|
|
|
|
Future initDownloadThreadCount() async {
|
|
|
|
_downloadThreadCount = await method.loadDownloadThreadCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget downloadThreadCountSetting() {
|
|
|
|
return StatefulBuilder(
|
|
|
|
builder: (BuildContext context, void Function(void Function()) setState) {
|
|
|
|
return ListTile(
|
2022-03-19 04:12:27 +00:00
|
|
|
title: const Text("下载线程数"),
|
2021-10-31 06:01:19 +00:00
|
|
|
subtitle: Text("$_downloadThreadCount"),
|
|
|
|
onTap: () async {
|
|
|
|
int? value = await chooseListDialog(context, "选择下载线程数", _values);
|
|
|
|
if (value != null) {
|
|
|
|
await method.saveDownloadThreadCount(value);
|
|
|
|
_downloadThreadCount = value;
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|