Commit c9324d97 authored by tongzifang's avatar tongzifang

增加角标

parent 11987ff9
class UserFeedBackImgs{
static String get user_feedback_camare => "images/ic_feedback_camare.png";
static String get user_feedback_del => "images/ic_feedback_img_del.png";
static String get user_feedback_corner => "images/ic_feedback_corner.png";
}
\ No newline at end of file
class UserFeedBackString{
static String get current_name => "qmsd_flutter_user_feedback";
static String get title => "意见反馈";
static String get feedback_type => "问题类型";
static String get feedback_type_a => "产品建议";
......
......@@ -13,7 +13,6 @@ import 'package:image_picker/image_picker.dart';
import 'package:qmsd_flutter_user_feedback/config/user_feedback_imgs.dart';
import 'package:qmsd_flutter_user_feedback/request/user_feedback_client.dart';
import 'package:photo_manager/photo_manager.dart';
import 'config/user_feedback_strings.dart';
class UserFeedBackPage extends StatefulWidget {
......@@ -109,47 +108,65 @@ class _UserFeedBackPageState extends State<UserFeedBackPage> {
_getFeedTypeSin(int feedType) {
return Expanded(
child: GestureDetector(
onTap: () => setState(() {
_feedType = feedType;
}),
child: Container(
margin: EdgeInsets.only(
top: 10, left: feedType == 2 ? 6 : 0, right: feedType == 1 ? 6 : 0),
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
color: _feedType == feedType
? CommonColor.colorMainGreen
: CommonColor.colorF8,
borderRadius: BorderRadius.circular(4)),
child: Text.rich(
TextSpan(children: [
TextSpan(
text: feedType == 1
? UserFeedBackString.feedback_type_a
: UserFeedBackString.feedback_type_b,
style: TextStyle(
color: CommonColor.color33,
fontSize: 15,
fontWeight: FontWeight.w600)),
const TextSpan(
text: "\n",
),
TextSpan(
text: feedType == 1
? UserFeedBackString.feedback_type_a_tip
: UserFeedBackString.feedback_type_b_tip,
style: TextStyle(
color: CommonColor.colorBlack,
fontSize: 12,
height: 2,
fontWeight: FontWeight.w500))
]),
textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis,
),
),
));
child: SizedBox(
height: 70,
child: Stack(
children: [
Positioned(
left: 0,
top: 10,
right: 0,
bottom: 0,
child: GestureDetector(
onTap: () => setState(() {
_feedType = feedType;
}),
child: Container(
alignment: Alignment.center,
margin: EdgeInsets.only(
left: feedType == 2 ? 6 : 0,
right: feedType == 1 ? 6 : 0),
padding: EdgeInsets.only(top: 8),
decoration: BoxDecoration(
color: _feedType == feedType
? CommonColor.colorMainGreen
: CommonColor.colorF8,
borderRadius: BorderRadius.circular(4)),
child: Column(children: [
Text(
feedType == 1
? UserFeedBackString.feedback_type_a
: UserFeedBackString.feedback_type_b,
style: TextStyle(
color: CommonColor.color33,
fontSize: 15,
fontWeight: FontWeight.w600)),
Text(
feedType == 1
? UserFeedBackString.feedback_type_a_tip
: UserFeedBackString.feedback_type_b_tip,
style: TextStyle(
color: CommonColor.colorBlack,
fontSize: 12,
height: 2,
overflow: TextOverflow.ellipsis,
fontWeight: FontWeight.w500)),
]),
),
)),
Positioned(
right: feedType == 1 ? 6 : 0,
bottom: 0,
child: Visibility(
visible: _feedType == feedType,
child: Image.asset(
UserFeedBackImgs.user_feedback_corner,
height: 16,
package: UserFeedBackString.current_name,
),
))
],
)));
}
_feedbackDes() {
......@@ -215,20 +232,41 @@ class _UserFeedBackPageState extends State<UserFeedBackPage> {
fontSize: 17,
),
),
GridView.builder(
shrinkWrap: true,
physics: const BouncingScrollPhysics(),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4,
childAspectRatio: 1,
SizedBox(
height: 90,
child: Stack(
children: [
Positioned(
left: 0,
top: 10,
right: 0,
bottom: 0,
child: GridView.builder(
shrinkWrap: true,
physics: const BouncingScrollPhysics(),
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4,
childAspectRatio: 1,
),
itemCount: imgFeed.length < 3 ? imgFeed.length + 1 : 3,
itemBuilder: (context, index) {
// return Image.file(File(imgAD[index].path));
return index < imgFeed.length
? _singleAD(index)
: _imgAdd(index);
},
)),
Positioned(
right: 0,
bottom: 0,
child: Text(
"${imgFeed.length}/3",
style:
TextStyle(fontSize: 13, color: CommonColor.colorBB),
)),
],
),
itemCount: imgFeed.length + 1,
itemBuilder: (context, index) {
// return Image.file(File(imgAD[index].path));
return index == imgFeed.length
? _imgAdd(index)
: _singleAD(index);
},
),
],
),
......@@ -265,7 +303,7 @@ class _UserFeedBackPageState extends State<UserFeedBackPage> {
child: Image.asset(
UserFeedBackImgs.user_feedback_del,
width: 18,
package: "qmsd_flutter_user_feedback",
package: UserFeedBackString.current_name,
)),
)
],
......@@ -294,7 +332,7 @@ class _UserFeedBackPageState extends State<UserFeedBackPage> {
child: Image.asset(
UserFeedBackImgs.user_feedback_camare,
width: 14,
package: "qmsd_flutter_user_feedback",
package: UserFeedBackString.current_name,
)),
const TextSpan(
text: '\n',
......@@ -336,6 +374,10 @@ class _UserFeedBackPageState extends State<UserFeedBackPage> {
}
getLostData(int pos) async {
if (imgFeed.length >= 3) {
QmToast.toast("最多选3张图片");
return;
}
final ImagePicker picker = ImagePicker();
final XFile? image =
await picker.pickImage(source: ImageSource.gallery, imageQuality: 70);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment