feat: vibration
This commit is contained in:
@ -9,6 +9,7 @@ import 'package:pilipala/models/common/dynamics_type.dart';
|
|||||||
import 'package:pilipala/models/dynamics/result.dart';
|
import 'package:pilipala/models/dynamics/result.dart';
|
||||||
import 'package:pilipala/models/dynamics/up.dart';
|
import 'package:pilipala/models/dynamics/up.dart';
|
||||||
import 'package:pilipala/models/live/item.dart';
|
import 'package:pilipala/models/live/item.dart';
|
||||||
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
|
|
||||||
class DynamicsController extends GetxController {
|
class DynamicsController extends GetxController {
|
||||||
int page = 1;
|
int page = 1;
|
||||||
@ -78,6 +79,7 @@ class DynamicsController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pushDetail(item, floor, {action = 'all'}) async {
|
pushDetail(item, floor, {action = 'all'}) async {
|
||||||
|
feedBack();
|
||||||
if (action == 'comment') {
|
if (action == 'comment') {
|
||||||
Get.toNamed('/dynamicDetail',
|
Get.toNamed('/dynamicDetail',
|
||||||
arguments: {'item': item, 'floor': floor, 'action': action});
|
arguments: {'item': item, 'floor': floor, 'action': action});
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import 'package:pilipala/common/widgets/http_error.dart';
|
|||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
import 'package:pilipala/models/dynamics/result.dart';
|
import 'package:pilipala/models/dynamics/result.dart';
|
||||||
import 'package:pilipala/pages/mine/index.dart';
|
import 'package:pilipala/pages/mine/index.dart';
|
||||||
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
import 'controller.dart';
|
import 'controller.dart';
|
||||||
@ -143,6 +144,7 @@ class _DynamicsPageState extends State<DynamicsPage>
|
|||||||
duration: const Duration(milliseconds: 300),
|
duration: const Duration(milliseconds: 300),
|
||||||
curve: Curves.easeInOut,
|
curve: Curves.easeInOut,
|
||||||
onValueChanged: (v) {
|
onValueChanged: (v) {
|
||||||
|
feedBack();
|
||||||
_dynamicsController.onSelectType(v);
|
_dynamicsController.onSelectType(v);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -155,7 +157,8 @@ class _DynamicsPageState extends State<DynamicsPage>
|
|||||||
bottom: 0,
|
bottom: 0,
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
onPressed: () => _dynamicsController.resetSearch(),
|
onPressed: () =>
|
||||||
|
{feedBack(), _dynamicsController.resetSearch()},
|
||||||
icon: const Icon(Icons.history, size: 21),
|
icon: const Icon(Icons.history, size: 21),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -167,7 +170,9 @@ class _DynamicsPageState extends State<DynamicsPage>
|
|||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: user.get(UserBoxKey.userLogin) ?? false
|
child: user.get(UserBoxKey.userLogin) ?? false
|
||||||
? GestureDetector(
|
? GestureDetector(
|
||||||
onTap: () => showModalBottomSheet(
|
onTap: () {
|
||||||
|
feedBack();
|
||||||
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (_) => const SizedBox(
|
builder: (_) => const SizedBox(
|
||||||
height: 450,
|
height: 450,
|
||||||
@ -175,7 +180,8 @@ class _DynamicsPageState extends State<DynamicsPage>
|
|||||||
),
|
),
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
),
|
);
|
||||||
|
},
|
||||||
child: NetworkImgLayer(
|
child: NetworkImgLayer(
|
||||||
type: 'avatar',
|
type: 'avatar',
|
||||||
width: 30,
|
width: 30,
|
||||||
@ -184,7 +190,9 @@ class _DynamicsPageState extends State<DynamicsPage>
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
: IconButton(
|
: IconButton(
|
||||||
onPressed: () => showModalBottomSheet(
|
onPressed: () {
|
||||||
|
feedBack();
|
||||||
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (_) => const SizedBox(
|
builder: (_) => const SizedBox(
|
||||||
height: 450,
|
height: 450,
|
||||||
@ -192,7 +200,8 @@ class _DynamicsPageState extends State<DynamicsPage>
|
|||||||
),
|
),
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
),
|
);
|
||||||
|
},
|
||||||
icon: const Icon(CupertinoIcons.person, size: 22),
|
icon: const Icon(CupertinoIcons.person, size: 22),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:pilipala/http/dynamics.dart';
|
import 'package:pilipala/http/dynamics.dart';
|
||||||
import 'package:pilipala/models/dynamics/result.dart';
|
import 'package:pilipala/models/dynamics/result.dart';
|
||||||
import 'package:pilipala/pages/dynamics/index.dart';
|
import 'package:pilipala/pages/dynamics/index.dart';
|
||||||
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
|
|
||||||
class ActionPanel extends StatefulWidget {
|
class ActionPanel extends StatefulWidget {
|
||||||
const ActionPanel({
|
const ActionPanel({
|
||||||
@ -31,6 +32,7 @@ class _ActionPanelState extends State<ActionPanel> {
|
|||||||
|
|
||||||
// 动态点赞
|
// 动态点赞
|
||||||
onLikeDynamic() async {
|
onLikeDynamic() async {
|
||||||
|
feedBack();
|
||||||
var item = widget.item!;
|
var item = widget.item!;
|
||||||
String dynamicId = item.idStr!;
|
String dynamicId = item.idStr!;
|
||||||
// 1 已点赞 2 不喜欢 0 未操作
|
// 1 已点赞 2 不喜欢 0 未操作
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
|
|
||||||
Widget author(item, context) {
|
Widget author(item, context) {
|
||||||
@ -10,12 +11,16 @@ Widget author(item, context) {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => Get.toNamed(
|
onTap: () {
|
||||||
|
feedBack();
|
||||||
|
Get.toNamed(
|
||||||
'/member?mid=${item.modules.moduleAuthor.mid}',
|
'/member?mid=${item.modules.moduleAuthor.mid}',
|
||||||
arguments: {
|
arguments: {
|
||||||
'face': item.modules.moduleAuthor.face,
|
'face': item.modules.moduleAuthor.face,
|
||||||
'heroTag': heroTag
|
'heroTag': heroTag
|
||||||
}),
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
child: Hero(
|
child: Hero(
|
||||||
tag: heroTag,
|
tag: heroTag,
|
||||||
child: NetworkImgLayer(
|
child: NetworkImgLayer(
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import 'package:pilipala/common/widgets/network_img_layer.dart';
|
|||||||
import 'package:pilipala/models/dynamics/up.dart';
|
import 'package:pilipala/models/dynamics/up.dart';
|
||||||
import 'package:pilipala/models/live/item.dart';
|
import 'package:pilipala/models/live/item.dart';
|
||||||
import 'package:pilipala/pages/dynamics/controller.dart';
|
import 'package:pilipala/pages/dynamics/controller.dart';
|
||||||
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
|
|
||||||
@ -81,7 +82,7 @@ class _UpPanelState extends State<UpPanel> {
|
|||||||
),
|
),
|
||||||
Material(
|
Material(
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () => Get.toNamed('/follow'),
|
onTap: () => {feedBack(), Get.toNamed('/follow')},
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 100,
|
height: 100,
|
||||||
padding: const EdgeInsets.only(left: 10, right: 10),
|
padding: const EdgeInsets.only(left: 10, right: 10),
|
||||||
@ -111,6 +112,7 @@ class _UpPanelState extends State<UpPanel> {
|
|||||||
bool isCurrent = currentMid == data.mid || currentMid == -1;
|
bool isCurrent = currentMid == data.mid || currentMid == -1;
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
feedBack();
|
||||||
if (data.type == 'up') {
|
if (data.type == 'up') {
|
||||||
currentMid = data.mid;
|
currentMid = data.mid;
|
||||||
Get.find<DynamicsController>().mid.value = data.mid;
|
Get.find<DynamicsController>().mid.value = data.mid;
|
||||||
@ -149,6 +151,7 @@ class _UpPanelState extends State<UpPanel> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLongPress: () {
|
onLongPress: () {
|
||||||
|
feedBack();
|
||||||
String heroTag = Utils.makeHeroTag(data.mid);
|
String heroTag = Utils.makeHeroTag(data.mid);
|
||||||
Get.toNamed('/member?mid=${data.mid}',
|
Get.toNamed('/member?mid=${data.mid}',
|
||||||
arguments: {'face': data.face, 'heroTag': heroTag});
|
arguments: {'face': data.face, 'heroTag': heroTag});
|
||||||
|
|||||||
@ -1,13 +1,17 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
|
|
||||||
Widget followItem({item}) {
|
Widget followItem({item}) {
|
||||||
String heroTag = Utils.makeHeroTag(item!.mid);
|
String heroTag = Utils.makeHeroTag(item!.mid);
|
||||||
return ListTile(
|
return ListTile(
|
||||||
onTap: () => Get.toNamed('/member?mid=${item.mid}',
|
onTap: () {
|
||||||
arguments: {'face': item.face, 'heroTag': heroTag}),
|
feedBack();
|
||||||
|
Get.toNamed('/member?mid=${item.mid}',
|
||||||
|
arguments: {'face': item.face, 'heroTag': heroTag});
|
||||||
|
},
|
||||||
leading: Hero(
|
leading: Hero(
|
||||||
tag: heroTag,
|
tag: heroTag,
|
||||||
child: NetworkImgLayer(
|
child: NetworkImgLayer(
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:pilipala/pages/hot/index.dart';
|
import 'package:pilipala/pages/hot/index.dart';
|
||||||
import 'package:pilipala/pages/live/index.dart';
|
import 'package:pilipala/pages/live/index.dart';
|
||||||
import 'package:pilipala/pages/rcmd/index.dart';
|
import 'package:pilipala/pages/rcmd/index.dart';
|
||||||
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
import './controller.dart';
|
import './controller.dart';
|
||||||
|
|
||||||
class HomePage extends StatefulWidget {
|
class HomePage extends StatefulWidget {
|
||||||
@ -92,7 +93,8 @@ class _HomePageState extends State<HomePage>
|
|||||||
dividerColor: Colors.transparent,
|
dividerColor: Colors.transparent,
|
||||||
unselectedLabelColor:
|
unselectedLabelColor:
|
||||||
Theme.of(context).colorScheme.outline,
|
Theme.of(context).colorScheme.outline,
|
||||||
onTap: (value) => {_homeController.initialIndex = value},
|
onTap: (value) =>
|
||||||
|
{feedBack(), _homeController.initialIndex = value},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -103,6 +105,7 @@ class _HomePageState extends State<HomePage>
|
|||||||
tag: 'searchTag',
|
tag: 'searchTag',
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
feedBack();
|
||||||
Get.toNamed('/search');
|
Get.toNamed('/search');
|
||||||
},
|
},
|
||||||
icon: const Icon(CupertinoIcons.search, size: 21),
|
icon: const Icon(CupertinoIcons.search, size: 21),
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/pages/dynamics/index.dart';
|
import 'package:pilipala/pages/dynamics/index.dart';
|
||||||
import 'package:pilipala/pages/home/index.dart';
|
import 'package:pilipala/pages/home/index.dart';
|
||||||
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
import './controller.dart';
|
import './controller.dart';
|
||||||
|
|
||||||
@ -44,6 +45,7 @@ class _MainAppState extends State<MainApp> with SingleTickerProviderStateMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setIndex(int value) async {
|
void setIndex(int value) async {
|
||||||
|
feedBack();
|
||||||
if (selectedIndex != value) {
|
if (selectedIndex != value) {
|
||||||
selectedIndex = value;
|
selectedIndex = value;
|
||||||
_animationController!.reverse().then((_) {
|
_animationController!.reverse().then((_) {
|
||||||
|
|||||||
@ -2,17 +2,22 @@ import 'package:get/get.dart';
|
|||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/http/init.dart';
|
import 'package:pilipala/http/init.dart';
|
||||||
import 'package:pilipala/pages/mine/controller.dart';
|
import 'package:pilipala/pages/mine/controller.dart';
|
||||||
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
class SettingController extends GetxController {
|
class SettingController extends GetxController {
|
||||||
Box user = GStrorage.user;
|
Box user = GStrorage.user;
|
||||||
RxBool userLogin = false.obs;
|
RxBool userLogin = false.obs;
|
||||||
Box userInfoCache = GStrorage.userInfo;
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
|
Box setting = GStrorage.setting;
|
||||||
|
RxBool feedBackEnable = false.obs;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
userLogin.value = user.get(UserBoxKey.userLogin) ?? false;
|
userLogin.value = user.get(UserBoxKey.userLogin) ?? false;
|
||||||
|
feedBackEnable.value =
|
||||||
|
setting.get(SettingBoxKey.feedBackEnable, defaultValue: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
loginOut() async {
|
loginOut() async {
|
||||||
@ -21,4 +26,11 @@ class SettingController extends GetxController {
|
|||||||
userLogin.value = user.get(UserBoxKey.userLogin) ?? false;
|
userLogin.value = user.get(UserBoxKey.userLogin) ?? false;
|
||||||
userInfoCache.put('userInfoCache', null);
|
userInfoCache.put('userInfoCache', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 开启关闭震动反馈
|
||||||
|
onOpenFeedBack() {
|
||||||
|
feedBack();
|
||||||
|
feedBackEnable.value = !feedBackEnable.value;
|
||||||
|
setting.put(SettingBoxKey.feedBackEnable, feedBackEnable.value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,10 @@ class SettingPage extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
TextStyle subTitleStyle = Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.labelMedium!
|
||||||
|
.copyWith(color: Theme.of(context).colorScheme.outline);
|
||||||
final SettingController settingController = Get.put(SettingController());
|
final SettingController settingController = Get.put(SettingController());
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
@ -14,6 +18,28 @@ class SettingPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: [
|
||||||
|
Obx(
|
||||||
|
() => ListTile(
|
||||||
|
enableFeedback: true,
|
||||||
|
onTap: () => settingController.onOpenFeedBack(),
|
||||||
|
title: const Text('震动反馈'),
|
||||||
|
subtitle: Text('请确定手机设置中已开启震动反馈', style: subTitleStyle),
|
||||||
|
trailing: Transform.scale(
|
||||||
|
scale: 0.8,
|
||||||
|
child: Switch(
|
||||||
|
thumbIcon: MaterialStateProperty.resolveWith<Icon?>(
|
||||||
|
(Set<MaterialState> states) {
|
||||||
|
if (states.isNotEmpty &&
|
||||||
|
states.first == MaterialState.selected) {
|
||||||
|
return const Icon(Icons.done);
|
||||||
|
}
|
||||||
|
return null; // All other states will use the default thumbIcon.
|
||||||
|
}),
|
||||||
|
value: settingController.feedBackEnable.value,
|
||||||
|
onChanged: (value) => settingController.onOpenFeedBack()),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
Obx(
|
Obx(
|
||||||
() => Visibility(
|
() => Visibility(
|
||||||
visible: settingController.userLogin.value,
|
visible: settingController.userLogin.value,
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import 'package:pilipala/http/video.dart';
|
|||||||
import 'package:pilipala/models/user/fav_folder.dart';
|
import 'package:pilipala/models/user/fav_folder.dart';
|
||||||
import 'package:pilipala/models/video_detail_res.dart';
|
import 'package:pilipala/models/video_detail_res.dart';
|
||||||
import 'package:pilipala/pages/video/detail/controller.dart';
|
import 'package:pilipala/pages/video/detail/controller.dart';
|
||||||
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
import 'package:pilipala/utils/id_utils.dart';
|
import 'package:pilipala/utils/id_utils.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
import 'package:share_plus/share_plus.dart';
|
import 'package:share_plus/share_plus.dart';
|
||||||
@ -303,6 +304,7 @@ class VideoIntroController extends GetxController {
|
|||||||
|
|
||||||
// 选择文件夹
|
// 选择文件夹
|
||||||
onChoose(bool checkValue, int index) {
|
onChoose(bool checkValue, int index) {
|
||||||
|
feedBack();
|
||||||
List<FavFolderItemData> datalist = favFolderData.value.list!;
|
List<FavFolderItemData> datalist = favFolderData.value.list!;
|
||||||
for (var i = 0; i < datalist.length; i++) {
|
for (var i = 0; i < datalist.length; i++) {
|
||||||
if (i == index) {
|
if (i == index) {
|
||||||
@ -327,6 +329,7 @@ class VideoIntroController extends GetxController {
|
|||||||
|
|
||||||
// 关注/取关up
|
// 关注/取关up
|
||||||
Future actionRelationMod() async {
|
Future actionRelationMod() async {
|
||||||
|
feedBack();
|
||||||
if (user.get(UserBoxKey.userMid) == null) {
|
if (user.get(UserBoxKey.userMid) == null) {
|
||||||
SmartDialog.showToast('账号未登录');
|
SmartDialog.showToast('账号未登录');
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import 'package:pilipala/common/widgets/stat/danmu.dart';
|
|||||||
import 'package:pilipala/common/widgets/stat/view.dart';
|
import 'package:pilipala/common/widgets/stat/view.dart';
|
||||||
import 'package:pilipala/models/video_detail_res.dart';
|
import 'package:pilipala/models/video_detail_res.dart';
|
||||||
import 'package:pilipala/pages/video/detail/introduction/controller.dart';
|
import 'package:pilipala/pages/video/detail/introduction/controller.dart';
|
||||||
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
|
|
||||||
@ -125,6 +126,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
|
|
||||||
// 视频介绍
|
// 视频介绍
|
||||||
showIntroDetail() {
|
showIntroDetail() {
|
||||||
|
feedBack();
|
||||||
showBottomSheet(
|
showBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
enableDrag: true,
|
enableDrag: true,
|
||||||
@ -245,6 +247,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
],
|
],
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
feedBack();
|
||||||
int mid = !widget.loadingStatus
|
int mid = !widget.loadingStatus
|
||||||
? widget.videoDetail!.owner!.mid
|
? widget.videoDetail!.owner!.mid
|
||||||
: videoItem['owner'].mid;
|
: videoItem['owner'].mid;
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
|
|
||||||
class ActionRowItem extends StatelessWidget {
|
class ActionRowItem extends StatelessWidget {
|
||||||
final Icon? icon;
|
final Icon? icon;
|
||||||
@ -27,7 +28,10 @@ class ActionRowItem extends StatelessWidget {
|
|||||||
borderRadius: const BorderRadius.all(Radius.circular(30)),
|
borderRadius: const BorderRadius.all(Radius.circular(30)),
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () => onTap!(),
|
onTap: () => {
|
||||||
|
feedBack(),
|
||||||
|
onTap!(),
|
||||||
|
},
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(13, 6.5, 15, 6.3),
|
padding: const EdgeInsets.fromLTRB(13, 6.5, 15, 6.3),
|
||||||
child: Row(
|
child: Row(
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/common/widgets/http_error.dart';
|
import 'package:pilipala/common/widgets/http_error.dart';
|
||||||
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
class FavPanel extends StatefulWidget {
|
class FavPanel extends StatefulWidget {
|
||||||
@ -43,6 +44,7 @@ class _FavPanelState extends State<FavPanel> {
|
|||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
|
feedBack();
|
||||||
await widget.ctr!.actionFavVideo();
|
await widget.ctr!.actionFavVideo();
|
||||||
},
|
},
|
||||||
child: const Text('完成'),
|
child: const Text('完成'),
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
|
|
||||||
class MenuRow extends StatelessWidget {
|
class MenuRow extends StatelessWidget {
|
||||||
final bool? loadingStatus;
|
final bool? loadingStatus;
|
||||||
@ -62,7 +63,10 @@ class MenuRow extends StatelessWidget {
|
|||||||
borderRadius: const BorderRadius.all(Radius.circular(30)),
|
borderRadius: const BorderRadius.all(Radius.circular(30)),
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () => onTap!(),
|
onTap: () => {
|
||||||
|
feedBack(),
|
||||||
|
onTap!(),
|
||||||
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.fromLTRB(13, 5.5, 13, 5.5),
|
padding: const EdgeInsets.fromLTRB(13, 5.5, 13, 5.5),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import 'package:pilipala/http/reply.dart';
|
|||||||
import 'package:pilipala/models/common/reply_sort_type.dart';
|
import 'package:pilipala/models/common/reply_sort_type.dart';
|
||||||
import 'package:pilipala/models/common/reply_type.dart';
|
import 'package:pilipala/models/common/reply_type.dart';
|
||||||
import 'package:pilipala/models/video/reply/item.dart';
|
import 'package:pilipala/models/video/reply/item.dart';
|
||||||
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
|
|
||||||
class VideoReplyController extends GetxController {
|
class VideoReplyController extends GetxController {
|
||||||
VideoReplyController(
|
VideoReplyController(
|
||||||
@ -83,6 +84,7 @@ class VideoReplyController extends GetxController {
|
|||||||
|
|
||||||
// 排序搜索评论
|
// 排序搜索评论
|
||||||
queryBySort() {
|
queryBySort() {
|
||||||
|
feedBack();
|
||||||
switch (sortType) {
|
switch (sortType) {
|
||||||
case ReplySortType.time:
|
case ReplySortType.time:
|
||||||
sortType = ReplySortType.like;
|
sortType = ReplySortType.like;
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import 'package:pilipala/common/widgets/http_error.dart';
|
|||||||
import 'package:pilipala/models/common/reply_type.dart';
|
import 'package:pilipala/models/common/reply_type.dart';
|
||||||
import 'package:pilipala/pages/video/detail/index.dart';
|
import 'package:pilipala/pages/video/detail/index.dart';
|
||||||
import 'package:pilipala/pages/video/detail/replyNew/index.dart';
|
import 'package:pilipala/pages/video/detail/replyNew/index.dart';
|
||||||
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
import 'package:pilipala/utils/id_utils.dart';
|
import 'package:pilipala/utils/id_utils.dart';
|
||||||
import 'controller.dart';
|
import 'controller.dart';
|
||||||
import 'widgets/reply_item.dart';
|
import 'widgets/reply_item.dart';
|
||||||
@ -262,6 +263,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
|||||||
child: FloatingActionButton(
|
child: FloatingActionButton(
|
||||||
heroTag: null,
|
heroTag: null,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
feedBack();
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import 'package:pilipala/models/common/reply_type.dart';
|
|||||||
import 'package:pilipala/models/video/reply/item.dart';
|
import 'package:pilipala/models/video/reply/item.dart';
|
||||||
import 'package:pilipala/pages/video/detail/controller.dart';
|
import 'package:pilipala/pages/video/detail/controller.dart';
|
||||||
import 'package:pilipala/pages/video/detail/replyNew/index.dart';
|
import 'package:pilipala/pages/video/detail/replyNew/index.dart';
|
||||||
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
|
|
||||||
import 'zan.dart';
|
import 'zan.dart';
|
||||||
@ -86,6 +87,7 @@ class ReplyItem extends StatelessWidget {
|
|||||||
// 头像、昵称
|
// 头像、昵称
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
feedBack();
|
||||||
Get.toNamed('/member?mid=${replyItem!.mid}', arguments: {
|
Get.toNamed('/member?mid=${replyItem!.mid}', arguments: {
|
||||||
'face': replyItem!.member!.avatar!,
|
'face': replyItem!.member!.avatar!,
|
||||||
'heroTag': heroTag
|
'heroTag': heroTag
|
||||||
@ -259,6 +261,7 @@ class ReplyItem extends StatelessWidget {
|
|||||||
.labelMedium!
|
.labelMedium!
|
||||||
.copyWith(color: Theme.of(context).colorScheme.outline)),
|
.copyWith(color: Theme.of(context).colorScheme.outline)),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
feedBack();
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
@ -348,6 +351,7 @@ class ReplyItemRow extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
recognizer: TapGestureRecognizer()
|
recognizer: TapGestureRecognizer()
|
||||||
..onTap = () {
|
..onTap = () {
|
||||||
|
feedBack();
|
||||||
String heroTag =
|
String heroTag =
|
||||||
Utils.makeHeroTag(replies![i].member.mid);
|
Utils.makeHeroTag(replies![i].member.mid);
|
||||||
Get.toNamed(
|
Get.toNamed(
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|||||||
import 'package:pilipala/http/reply.dart';
|
import 'package:pilipala/http/reply.dart';
|
||||||
import 'package:pilipala/models/common/reply_type.dart';
|
import 'package:pilipala/models/common/reply_type.dart';
|
||||||
import 'package:pilipala/models/video/reply/item.dart';
|
import 'package:pilipala/models/video/reply/item.dart';
|
||||||
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
|
|
||||||
class ZanButton extends StatefulWidget {
|
class ZanButton extends StatefulWidget {
|
||||||
const ZanButton({
|
const ZanButton({
|
||||||
@ -22,6 +23,7 @@ class ZanButton extends StatefulWidget {
|
|||||||
class _ZanButtonState extends State<ZanButton> {
|
class _ZanButtonState extends State<ZanButton> {
|
||||||
// 评论点赞
|
// 评论点赞
|
||||||
onLikeReply() async {
|
onLikeReply() async {
|
||||||
|
feedBack();
|
||||||
SmartDialog.showLoading(msg: 'pilipala ...');
|
SmartDialog.showLoading(msg: 'pilipala ...');
|
||||||
ReplyItemModel replyItem = widget.replyItem!;
|
ReplyItemModel replyItem = widget.replyItem!;
|
||||||
int oid = replyItem.oid!;
|
int oid = replyItem.oid!;
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import 'package:hive/hive.dart';
|
|||||||
import 'package:pilipala/http/video.dart';
|
import 'package:pilipala/http/video.dart';
|
||||||
import 'package:pilipala/models/common/reply_type.dart';
|
import 'package:pilipala/models/common/reply_type.dart';
|
||||||
import 'package:pilipala/models/video/reply/item.dart';
|
import 'package:pilipala/models/video/reply/item.dart';
|
||||||
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
class VideoReplyNewDialog extends StatefulWidget {
|
class VideoReplyNewDialog extends StatefulWidget {
|
||||||
@ -68,6 +69,7 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future submitReplyAdd() async {
|
Future submitReplyAdd() async {
|
||||||
|
feedBack();
|
||||||
String message = _replyContentController.text;
|
String message = _replyContentController.text;
|
||||||
var result = await VideoHttp.replyAdd(
|
var result = await VideoHttp.replyAdd(
|
||||||
type: widget.replyType ?? ReplyType.video,
|
type: widget.replyType ?? ReplyType.video,
|
||||||
|
|||||||
12
lib/utils/feed_back.dart
Normal file
12
lib/utils/feed_back.dart
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:hive/hive.dart';
|
||||||
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
|
Box setting = GStrorage.setting;
|
||||||
|
void feedBack() {
|
||||||
|
// 设置中是否开启
|
||||||
|
bool enable = setting.get(SettingBoxKey.feedBackEnable, defaultValue: false);
|
||||||
|
if (enable) {
|
||||||
|
HapticFeedback.lightImpact();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -13,6 +13,7 @@ class GStrorage {
|
|||||||
static late final Box hotKeyword;
|
static late final Box hotKeyword;
|
||||||
static late final Box historyword;
|
static late final Box historyword;
|
||||||
static late final Box localCache;
|
static late final Box localCache;
|
||||||
|
static late final Box setting;
|
||||||
|
|
||||||
static Future<void> init() async {
|
static Future<void> init() async {
|
||||||
final dir = await getApplicationDocumentsDirectory();
|
final dir = await getApplicationDocumentsDirectory();
|
||||||
@ -27,6 +28,8 @@ class GStrorage {
|
|||||||
userInfo = await Hive.openBox('userInfo');
|
userInfo = await Hive.openBox('userInfo');
|
||||||
// 本地缓存
|
// 本地缓存
|
||||||
localCache = await Hive.openBox('localCache');
|
localCache = await Hive.openBox('localCache');
|
||||||
|
// 设置
|
||||||
|
setting = await Hive.openBox('setting');
|
||||||
}
|
}
|
||||||
|
|
||||||
static regAdapter() {
|
static regAdapter() {
|
||||||
@ -61,6 +64,7 @@ class UserBoxKey {
|
|||||||
|
|
||||||
class SettingBoxKey {
|
class SettingBoxKey {
|
||||||
static const String themeMode = 'themeMode';
|
static const String themeMode = 'themeMode';
|
||||||
|
static const String feedBackEnable = 'feedBackEnable';
|
||||||
}
|
}
|
||||||
|
|
||||||
class LocalCacheKey {
|
class LocalCacheKey {
|
||||||
|
|||||||
Reference in New Issue
Block a user