115 lines
4.6 KiB
Dart
115 lines
4.6 KiB
Dart
|
|
import 'dart:io';
|
||
|
|
import 'package:example/data/settings/ui_settings.dart';
|
||
|
|
import 'package:example/theme/example_theme.dart';
|
||
|
|
import 'package:flutter/material.dart';
|
||
|
|
import 'package:get/get.dart';
|
||
|
|
import 'package:guru_utils/audio/audio_effector.dart';
|
||
|
|
import 'package:guru_widgets/pages/settings/guru_settings_page.dart';
|
||
|
|
import 'package:guru_widgets/button/single_tap_widget.dart';
|
||
|
|
import 'package:guru_widgets/common/flexible_container.dart';
|
||
|
|
import 'package:auto_size_text/auto_size_text.dart';
|
||
|
|
import 'package:guru_widgets/common/spacer.dart';
|
||
|
|
import 'package:guru_widgets/theme/guru_theme.dart';
|
||
|
|
import 'package:guru_widgets/banner/purchase_banner.dart';
|
||
|
|
import 'package:guru_utils/router/router.dart';
|
||
|
|
|
||
|
|
import '../../route/router.dart';
|
||
|
|
import 'remove_ads/remove_ads_card.dart';
|
||
|
|
import 'settings_controller.dart';
|
||
|
|
|
||
|
|
class SettingsPage extends GetWidget<SettingsController> {
|
||
|
|
final GlobalKey tipsKey = GlobalKey();
|
||
|
|
|
||
|
|
SettingsPage({ Key? key}) : super(key: key);
|
||
|
|
|
||
|
|
InseparableSettingItem _buildSound() {
|
||
|
|
return SwitchSetting(
|
||
|
|
enabledTitle: "Sound Effects",
|
||
|
|
leading: "assets/images/ic_sound.png",
|
||
|
|
settingData: UiSettings.instance.checkedTileBol,
|
||
|
|
onChanged: ((value) {
|
||
|
|
UiSettings.instance.checkedTileBol.set(value);
|
||
|
|
controller.changeValue(value);
|
||
|
|
})
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
InseparableSettingItem _buildVibration() {
|
||
|
|
return SwitchSetting(
|
||
|
|
enabledTitle: "Vibration",
|
||
|
|
leading: "assets/images/ic_zhendong.png",
|
||
|
|
settingData: UiSettings.instance.checkedTileBol,
|
||
|
|
onChanged: ((value) {
|
||
|
|
UiSettings.instance.checkedTileBol.set(value);
|
||
|
|
})
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
InseparableSettingItem _buildTheme() {
|
||
|
|
return EntranceSetting(title: "Theme", leading: "assets/images/ic_theme.png");
|
||
|
|
}
|
||
|
|
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
final controller = Get.find<SettingsController>();
|
||
|
|
final model = Get.find<SettingsController>().model;
|
||
|
|
final guruTheme = ExampleThemes.defaultGuruTheme;
|
||
|
|
|
||
|
|
|
||
|
|
return GuruSettingsPage(
|
||
|
|
items: [
|
||
|
|
// CustomSetting(builder: (context, snapshot) {
|
||
|
|
// return snapshot.data == true ? Container(
|
||
|
|
// width: MediaQuery.of(context).size.width,
|
||
|
|
// padding: Platform.isAndroid ? controller.designModel.androidRemoveAdsMargin : controller.designModel.iosRemoveAdsMargin,
|
||
|
|
// color: Platform.isAndroid ? Colors.transparent : guruTheme.listTileTheme.backgroundColor ?? guruTheme.colorScheme.containerColor ?? Colors.white,
|
||
|
|
// child: RemoveAdsCard(
|
||
|
|
// cardSpec: controller.designModel.removeAdsSpec
|
||
|
|
// ),
|
||
|
|
// ) : Container();
|
||
|
|
// }, stream: controller.valueStream),
|
||
|
|
WidgetSetting(hasDivider: false, widget: StreamBuilder<bool>(
|
||
|
|
stream: controller.valueStream,
|
||
|
|
builder: (context, snapshot) {
|
||
|
|
return snapshot.data == true ? Container(
|
||
|
|
padding: Platform.isAndroid ? controller.designModel.androidRemoveAdsMargin : controller.designModel.iosRemoveAdsMargin,
|
||
|
|
color: Platform.isAndroid ? Colors.transparent : guruTheme.listTileTheme.backgroundColor ?? guruTheme.colorScheme.containerColor ?? Colors.white,
|
||
|
|
child: PurchaseBanner(summary: 'Remove Banner ', price: '2.2', tips: 'All banner ads and pop-up ads will be removed permanently, except for rewarded video ads.'),
|
||
|
|
) : Container();
|
||
|
|
},
|
||
|
|
)),
|
||
|
|
...(Platform.isIOS ? [
|
||
|
|
EntranceSetting(title: "Restore Purchases", leading: "assets/images/ic_restore.png"),
|
||
|
|
GroupSetting(title: "PREFERENCE", items: [
|
||
|
|
_buildSound(),
|
||
|
|
_buildVibration(),
|
||
|
|
_buildTheme()
|
||
|
|
])
|
||
|
|
] : []),
|
||
|
|
...(Platform.isAndroid ? [
|
||
|
|
_buildSound(),
|
||
|
|
_buildVibration(),
|
||
|
|
_buildTheme()
|
||
|
|
] : []),
|
||
|
|
// _buildSound(),
|
||
|
|
// _buildVibration(),
|
||
|
|
// _buildTheme(),
|
||
|
|
GroupSetting(
|
||
|
|
title: "INFORMATION",
|
||
|
|
items: [
|
||
|
|
EntranceSetting(title: "Share App", leading: "assets/images/ic_share.png"),
|
||
|
|
EntranceSetting(title: "Contact Us", leading: "assets/images/ic_message.png"),
|
||
|
|
EntranceSetting(title: "Contribute to Translate", leading: "assets/images/ic_volunteer.png"),
|
||
|
|
EntranceSetting(title: "Become a Volunteer Translator (Two lines)", leading: "assets/images/ic_volunteer.png")
|
||
|
|
]
|
||
|
|
)
|
||
|
|
],
|
||
|
|
policyUrl: Uri.parse("https://www.baidu.com"),
|
||
|
|
termsOfServiceUrl: Uri.parse("https://www.baidu.com"),
|
||
|
|
// onPolicyTap: () {
|
||
|
|
// RouteCenter.instance.openPath(Routes.webview.path());
|
||
|
|
// },
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|