pikapika/lib/basic/config/NoAnimation.dart

44 lines
1.0 KiB
Dart

import 'dart:io';
import 'package:flutter/material.dart';
import '../Common.dart';
import '../Method.dart';
const _propertyName = "noAnimation";
late bool _noAnimation;
Future initNoAnimation() async {
_noAnimation = (await method.loadProperty(_propertyName, "false")) == "true";
}
bool noAnimation() {
return _noAnimation;
}
Future<void> _chooseNoAnimation(BuildContext context) async {
String? result =
await chooseListDialog<String>(context, "取消翻页动画", ["", ""]);
if (result != null) {
var target = result == "";
await method.saveProperty(_propertyName, "$target");
_noAnimation = target;
}
}
Widget noAnimationSetting() {
return StatefulBuilder(
builder: (BuildContext context, void Function(void Function()) setState) {
return ListTile(
title: Text("取消翻页动画"),
subtitle: Text(_noAnimation ? "" : ""),
onTap: () async {
await _chooseNoAnimation(context);
setState(() {});
},
);
},
);
}