fix ios init error and view log auto scroll back

This commit is contained in:
niuhuan 2021-10-28 18:45:43 +08:00
parent cd10de8e89
commit 7cebc1d90c
2 changed files with 57 additions and 35 deletions

View File

@ -10,7 +10,12 @@ import '../Method.dart';
late String _downloadAndExportPath; late String _downloadAndExportPath;
Future initDownloadAndExportPath() async { Future initDownloadAndExportPath() async {
_downloadAndExportPath = await method.loadDownloadAndExportPath(); if (Platform.isWindows ||
Platform.isMacOS ||
Platform.isAndroid ||
Platform.isLinux) {
_downloadAndExportPath = await method.loadDownloadAndExportPath();
}
} }
Widget downloadAndExportPathSetting() { Widget downloadAndExportPathSetting() {

View File

@ -164,42 +164,59 @@ class ViewLogWrap extends StatelessWidget {
var size = MediaQuery.of(context).size; var size = MediaQuery.of(context).size;
var min = size.width < size.height ? size.width : size.height; var min = size.width < size.height ? size.width : size.height;
var width = (min - 45) / 4; var width = (min - 45) / 4;
return Wrap(
alignment: WrapAlignment.spaceAround, var entries = comics.map((e) {
children: comics.map((e) { return InkWell(
return InkWell( key: e.key,
key: e.key, onTap: () {
onTap: () { onTapComic(e.id);
onTapComic(e.id); },
}, onLongPress: () {
onLongPress: () { onDelete(e.id);
onDelete(e.id); },
}, child: Card(
child: Card( child: Container(
child: Container( width: width,
width: width, child: Column(
child: Column( children: [
children: [ LayoutBuilder(builder:
LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints) {
(BuildContext context, BoxConstraints constraints) { return RemoteImage(
return RemoteImage( width: constraints.maxWidth,
width: constraints.maxWidth, fileServer: e.fileServer,
fileServer: e.fileServer, path: e.path);
path: e.path); }),
}), Text(
Text( e.title + '\n',
e.title + '\n', maxLines: 2,
maxLines: 2, overflow: TextOverflow.ellipsis,
overflow: TextOverflow.ellipsis, style: TextStyle(height: 1.4),
style: TextStyle(height: 1.4), strutStyle: StrutStyle(height: 1.4),
strutStyle: StrutStyle(height: 1.4), ),
), ],
],
),
), ),
), ),
); ),
}).toList(), );
});
Map<int, List<Widget>> map = Map();
for (var i = 0; i < entries.length; i++) {
late List<Widget> list;
if (i % 4 == 0) {
list = [];
map[i ~/ 4] = list;
} else {
list = map[i ~/ 4]!;
}
list.add(entries.elementAt(i));
}
return Column(
children: map.values.map((e) => Wrap(
alignment: WrapAlignment.spaceAround,
children: e,
)).toList(),
); );
} }
} }