diff --git a/lib/pages/mine/feedback_page.dart b/lib/pages/mine/feedback_page.dart index 6163890..7566979 100644 --- a/lib/pages/mine/feedback_page.dart +++ b/lib/pages/mine/feedback_page.dart @@ -1,4 +1,5 @@ import 'package:dating_touchme_app/components/page_appbar.dart'; +import 'package:dating_touchme_app/extension/ex_widget.dart'; import 'package:dating_touchme_app/generated/assets.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -16,6 +17,18 @@ class _FeedbackPageState extends State { final TextEditingController _messageController = TextEditingController(); String phone = ''; final TextEditingController _phoneController = TextEditingController(); + + List tagList = ["举报投诉", "账号与个人信息", "现有功能建议", "新功能或玩法建议"]; + + int active = 0; + + changeActive(int i){ + active = i; + setState(() { + + }); + } + @override Widget build(BuildContext context) { return Stack( @@ -119,10 +132,9 @@ class _FeedbackPageState extends State { spacing: 10.w, runSpacing: 10.w, children: [ - TagItem(title: "举报投诉"), - TagItem(title: "账号与个人信息"), - TagItem(title: "现有功能建议"), - TagItem(title: "新功能或玩法建议"), + ...tagList.asMap().entries.map((entry){ + return TagItem(title: entry.value, index: entry.key, active: active, changeActive: changeActive,); + }), ], ), SizedBox(height: 20.w,), @@ -343,7 +355,10 @@ class _FeedbackPageState extends State { class TagItem extends StatefulWidget { final String title; - const TagItem({super.key, required this.title}); + final int index; + final int active; + final void Function(int) changeActive; + const TagItem({super.key, required this.title, required this.index, required this.active, required this.changeActive}); @override State createState() => _TagItemState(); @@ -352,21 +367,49 @@ class TagItem extends StatefulWidget { class _TagItemState extends State { @override Widget build(BuildContext context) { - return Container( - padding: EdgeInsets.symmetric( - vertical: 9.w, - horizontal: 14.w - ), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(8.w)), - border: Border.all(width: 1, color: const Color.fromRGBO(207, 207, 207, 1)) - ), - child: Text( - widget.title, - style: TextStyle( - fontSize: 13.w - ), - ), + return Stack( + children: [ + Container( + padding: EdgeInsets.symmetric( + vertical: 9.w, + horizontal: 14.w + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(8.w)), + border: Border.all(width: 1, color: widget.index == widget.active ? const Color.fromRGBO(117, 98, 249, 1) : const Color.fromRGBO(207, 207, 207, 1)), + color: widget.index == widget.active ? const Color.fromRGBO(194, 195, 255, 0.2) : Colors.transparent + ), + child: Text( + widget.title, + style: TextStyle( + fontSize: 13.w + ), + ), + ).onTap((){ + widget.changeActive(widget.index); + }), + if(widget.active == widget.index)Positioned( + bottom: 0, + right: 0, + child: Container( + width: 17.w, + height: 13.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8.w), + bottomRight: Radius.circular(8.w) + ), + color: const Color.fromRGBO(117, 98, 249, 1) + ), + child: Center( + child: Image.asset( + Assets.imagesCheck, + width: 6.w, + ), + ), + ), + ) + ], ); } }