更新社区

hmxc
张萌 4 years ago
parent 4fd67e048f
commit fdf177fd17

@ -1,5 +1,6 @@
import 'dart:ui';
import 'package:akuCommunity/base/base_style.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_icons/flutter_icons.dart';
@ -8,6 +9,8 @@ import 'package:akuCommunity/widget/expandable_text.dart';
import 'package:akuCommunity/widget/image_grid.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:akuCommunity/extensions/num_ext.dart';
class TrendCard extends StatefulWidget {
final String name;
@ -15,7 +18,13 @@ class TrendCard extends StatefulWidget {
final List<String> imageUrl;
final bool isLike;
final Image avatar;
TrendCard({Key key, this.name, this.content, this.imageUrl, this.isLike, this.avatar})
TrendCard(
{Key key,
this.name,
this.content,
this.imageUrl,
this.isLike,
this.avatar})
: super(key: key);
@override
@ -29,6 +38,7 @@ class _TrendCardState extends State<TrendCard> {
super.initState();
_isLike = widget.isLike ?? false;
}
void _showDialog(String url) {
showCupertinoDialog(
context: context,
@ -73,107 +83,6 @@ class _TrendCardState extends State<TrendCard> {
);
}
void showPub() {
showModalBottomSheet(
context: context,
builder: (BuildContext context) {
return _shareWidget();
});
}
Widget _shareWidget() {
return Container(
color: Colors.white,
height:
300.w + MediaQuery.of(context).viewPadding.bottom,
child: Stack(
children: [
Container(
height: 160.w,
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemBuilder: (BuildContext context, int index) {
return InkWell(
onTap: () {
Get.back();
_showDialog(nameItems[index]['title']);
},
child: Container(
height: 160.w,
width: 160.w,
margin: EdgeInsets.only(
left: 10.w,
right: 10.w,
top: 40.w,
),
alignment: Alignment.center,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
nameItems[index]['image'],
width: 65.w,
height: 65.w,
),
Container(
margin: EdgeInsets.only(top: 10.w),
child: Text(
nameItems[index]['title'],
style: TextStyle(
fontSize: 26.sp,
color: Color(0xff333333),
),
),
),
],
),
),
);
},
itemCount: nameItems.length,
),
),
Positioned(
bottom: 0,
child: InkWell(
onTap: () {
Get.back();
},
child: Container(
width: MediaQuery.of(context).size.width,
height: 98.w,
alignment: Alignment.center,
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.black12,
offset: Offset(1, 1),
blurRadius: 2.0,
)
],
),
child: Text(
'取消',
style: TextStyle(
fontSize: 38.sp,
color: Color(0xff333333),
),
),
),
),
),
],
),
);
}
List<Map<String, dynamic>> nameItems = [
{'image': 'assets/icons/report.png', 'title': '举报'},
{'image': 'assets/icons/shield_content.png', 'title': '屏蔽此条动态'},
{'image': 'assets/icons/shield_user.png', 'title': '屏蔽他的动态'},
];
TextStyle _textStyleName() {
return TextStyle(
fontSize: 36.sp,
@ -195,8 +104,6 @@ class _TrendCardState extends State<TrendCard> {
);
}
Widget _columnCard(String name, String content, Image avatar) {
return Stack(
children: [
@ -254,53 +161,137 @@ class _TrendCardState extends State<TrendCard> {
),
],
),
],
),
],
),
),
],
),
Positioned(
right: 0,
bottom: 0,
child: Builder(
builder: (context) {
return InkWell(
onTap: () => BotToast.showAttachedWidget(
attachedBuilder: (CancelFunc cancelFunc) {
return Material(
child: Container(
decoration: BoxDecoration(
color: Color(0xFFD8D8D8),
borderRadius: BorderRadius.circular(8.w),
),
padding: EdgeInsets.symmetric(
vertical: 15.w, horizontal: 30.w),
width: 363.w,
height: 78.w,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: InkWell(
onTap: () {
setState(() {
_isLike = !_isLike;
});
cancelFunc();
setState(() {});
},
child: Icon(
_isLike ? AntDesign.heart : AntDesign.hearto,
color:
_isLike ? Color(0xffff6666) : Color(0xffd8d8d8),
size: 36.sp,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
_isLike
? AntDesign.heart
: AntDesign.hearto,
color: _isLike
? Color(0xffff6666)
: Colors.black,
size: 32.w,
),
10.wb,
''
.text
.color(ktextPrimary)
.size(28.sp)
.make(),
],
),
),
),
Positioned(
right: 35,
bottom: 0,
Expanded(
child: VerticalDivider(
width: 0,
thickness: 1.w,
color: Color(0xFF979797),
),
),
Expanded(
child: InkWell(
onTap: () {},
child: Icon(
AntDesign.message1,
color: Color(0xffd8d8d8),
size: 36.sp,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
CupertinoIcons.ellipses_bubble,
color: Colors.black,
size: 32.w,
),
10.wb,
'评论'
.text
.color(ktextPrimary)
.size(28.sp)
.make(),
],
),
),
// _positionedPopupMenuButton(),
],
),
],
),
),
],
);
},
preferDirection: PreferDirection.rightCenter,
targetContext: context,
),
Positioned(
right: 0,
top: 0,
child: InkWell(
onTap: showPub,
child: Icon(
MaterialIcons.more,
color: Color(0xffd8d8d8),
),
);
},
),
),
Positioned(
top: 0,
right: 0,
child: PopupMenuButton(
padding: EdgeInsets.zero,
icon: Icon(
CupertinoIcons.chevron_down,
size: 25.w,
),
itemBuilder: (context) {
return [
PopupMenuItem(
child: Container(
width: 150.w,
height: 50.w,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
CupertinoIcons.exclamationmark_triangle,
size: 50.w,
),
10.wb,
'举报'.text.black.size(30.sp).make()
],
),
),
)
];
},
),
),
],
@ -325,7 +316,6 @@ class _TrendCardState extends State<TrendCard> {
bottom: 22.w,
right: 32.w,
),
child: _columnCard(widget.name, widget.content,widget.avatar)
);
child: _columnCard(widget.name, widget.content, widget.avatar));
}
}

@ -224,7 +224,7 @@ packages:
name: cupertino_icons
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.3"
version: "1.0.0"
dart_style:
dependency: transitive
description:

@ -26,7 +26,7 @@ dependencies:
provider: ^4.1.3
# 屏幕适配
flutter_screenutil: ^3.2.0
cupertino_icons: ^0.1.3
cupertino_icons: ^1.0.0
# 打电话等各种功能
url_launcher: 5.5.2
# UI库

Loading…
Cancel
Save