王子贤 3 months ago
parent
commit
d45562486b
4 changed files with 126 additions and 32 deletions
  1. 12
      lib/controller/home/timeline_info_controller.dart
  2. 38
      lib/pages/home/matchmaker_page.dart
  3. 11
      lib/pages/home/recommend_tab.dart
  4. 97
      lib/pages/home/timeline_info.dart

12
lib/controller/home/timeline_info_controller.dart

@ -33,6 +33,8 @@ class TimelineInfoController extends GetxController {
final message = ''.obs;
final messageController = TextEditingController().obs;
final focusNode = FocusNode().obs;
@override
void onInit() {
super.onInit();
@ -44,8 +46,16 @@ class TimelineInfoController extends GetxController {
_homeApi = Get.find<HomeApi>();
getPostData();
getCommentData();
}
@override
void onClose() {
super.onClose();
focusNode.value.dispose();
}
getPostData() async {
try {
final response = await _homeApi.userPagePostDetail(id: id);
@ -144,6 +154,8 @@ class TimelineInfoController extends GetxController {
getPostData();
getCommentData();
showInput.value = false;
FocusScope.of(Get.context!).unfocus();
parentId.value = "0";
message.value = "";

38
lib/pages/home/matchmaker_page.dart

@ -0,0 +1,38 @@
import 'package:dating_touchme_app/components/page_appbar.dart';
import 'package:dating_touchme_app/controller/home/home_controller.dart';
import 'package:dating_touchme_app/pages/home/nearby_tab.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class MatchmakerPage extends StatefulWidget {
const MatchmakerPage({super.key});
@override
State<MatchmakerPage> createState() => _MatchmakerPageState();
}
class _MatchmakerPageState extends State<MatchmakerPage> with AutomaticKeepAliveClientMixin {
final HomeController controller = Get.find<HomeController>();
@override
Widget build(BuildContext context) {
super.build(context);
return Scaffold(
appBar: PageAppbar(title: "金牌红娘"),
body: Column(
children: [
Expanded(
child: NearbyTab(),
)
],
),
);
}
@override
bool get wantKeepAlive => true;
}

11
lib/pages/home/recommend_tab.dart

@ -3,6 +3,7 @@ import 'package:dating_touchme_app/extension/ex_widget.dart';
import 'package:dating_touchme_app/generated/assets.dart';
import 'package:dating_touchme_app/pages/home/event_info.dart';
import 'package:dating_touchme_app/pages/home/matchmaker_item.dart';
import 'package:dating_touchme_app/pages/home/matchmaker_page.dart';
import 'package:dating_touchme_app/pages/mine/open_webview.dart';
import 'package:easy_refresh/easy_refresh.dart';
import 'package:flutter/material.dart';
@ -223,6 +224,16 @@ class _RecommendTabState extends State<RecommendTab>
fontWeight: FontWeight.w700
),
),
Text(
"查看更多",
style: TextStyle(
fontSize: 9.w,
color: const Color.fromRGBO(144, 144, 144, 1),
fontWeight: FontWeight.w500
),
).onTap((){
Get.to(() => MatchmakerPage());
})
],
),
Wrap(

97
lib/pages/home/timeline_info.dart

@ -7,6 +7,7 @@ import 'package:dating_touchme_app/model/home/post_comment_data.dart';
import 'package:dating_touchme_app/pages/home/report_page.dart';
import 'package:dating_touchme_app/pages/home/user_information_page.dart';
import 'package:easy_refresh/easy_refresh.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
@ -45,6 +46,33 @@ class TimelineInfo extends StatelessWidget {
color: const Color.fromRGBO(51, 51, 51, 1)
),
),
actions: [
Container(
margin: EdgeInsets.only(right: 14.w),
child: PopupMenuButton<String>(
tooltip: "",
padding: EdgeInsets.zero,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)),
color: Colors.white,
elevation: 8,
offset: Offset(0, 32.w), //
itemBuilder: (context) => [
const PopupMenuItem(value: 'report', child: Text('举报')),
],
onSelected: (v) {
if (v == 'report') {
print("举报");
Get.to(() => ReportPage(id: id,));
}
},
child: Icon(
Icons.keyboard_control,
size: 24.w,
color: const Color.fromRGBO(51, 51, 51, 1),
), //
),
)
],
),
body: Stack(
children: [
@ -138,28 +166,7 @@ class TimelineInfo extends StatelessWidget {
)
],
),
PopupMenuButton<String>(
tooltip: "",
padding: EdgeInsets.zero,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)),
color: Colors.white,
elevation: 8,
offset: Offset(0, 32.w), //
itemBuilder: (context) => [
const PopupMenuItem(value: 'report', child: Text('举报')),
],
onSelected: (v) {
if (v == 'report') {
print("举报");
Get.to(() => ReportPage(id: id,));
}
},
child: Icon(
Icons.keyboard_control,
size: 15.w,
color: const Color.fromRGBO(51, 51, 51, 1),
), //
),
],
),
Container(
@ -247,7 +254,9 @@ class TimelineInfo extends StatelessWidget {
)
],
).onTap((){
controller.showInput.value = true;
controller.focusNode.value.requestFocus();
// controller.update();
}),
],
@ -271,15 +280,36 @@ class TimelineInfo extends StatelessWidget {
),
),
),
if(controller.showInput.value) Positioned.fill(
child: Container(
color: const Color.fromRGBO(0, 0, 0, .4),
).onTap((){
controller.showInput.value = false;
// if(controller.showInput.value) Positioned.fill(
// child: Container(
// color: const Color.fromRGBO(0, 0, 0, .4),
// ).onTap((){
// controller.showInput.value = false;
// FocusScope.of(context).unfocus();
//
// }),
// ),
ListenableBuilder(
listenable: controller.focusNode.value, //
builder: (context, child) {
// builder
return Visibility(
visible: controller.focusNode.value.hasFocus,
child: GestureDetector(
onTap: () {
}),
FocusScope.of(context).unfocus();
controller.parentId.value = "0";
},
child: Container(
color: const Color.fromRGBO(0, 0, 0, .4),
//
),
),
);
},
),
if(controller.showInput.value) Positioned(
Positioned(
left: 0,
bottom: 0,
child: Container(
@ -296,8 +326,8 @@ class TimelineInfo extends StatelessWidget {
borderRadius: BorderRadius.all(Radius.circular(40.w))
),
child: TextField(
focusNode: controller.focusNode.value,
controller: controller.messageController.value,
autofocus: true,
style: TextStyle(
fontSize: ScreenUtil().setWidth(14),
height: 1
@ -437,7 +467,10 @@ class _CommentItemState extends State<CommentItem> {
),
).onTap((){
widget.controller.parentId.value = widget.item.id ?? "0";
widget.controller.showInput.value = true;
widget.controller.focusNode.value.requestFocus();
}),
],
),

Loading…
Cancel
Save