更新社区

hmxc
张萌 4 years ago
parent 4fd67e048f
commit fdf177fd17

@ -1,5 +1,6 @@
import 'dart:ui'; 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/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_icons/flutter_icons.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:akuCommunity/widget/image_grid.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:akuCommunity/extensions/num_ext.dart';
class TrendCard extends StatefulWidget { class TrendCard extends StatefulWidget {
final String name; final String name;
@ -15,7 +18,13 @@ class TrendCard extends StatefulWidget {
final List<String> imageUrl; final List<String> imageUrl;
final bool isLike; final bool isLike;
final Image avatar; 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); : super(key: key);
@override @override
@ -29,6 +38,7 @@ class _TrendCardState extends State<TrendCard> {
super.initState(); super.initState();
_isLike = widget.isLike ?? false; _isLike = widget.isLike ?? false;
} }
void _showDialog(String url) { void _showDialog(String url) {
showCupertinoDialog( showCupertinoDialog(
context: context, 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() { TextStyle _textStyleName() {
return TextStyle( return TextStyle(
fontSize: 36.sp, fontSize: 36.sp,
@ -195,8 +104,6 @@ class _TrendCardState extends State<TrendCard> {
); );
} }
Widget _columnCard(String name, String content, Image avatar) { Widget _columnCard(String name, String content, Image avatar) {
return Stack( return Stack(
children: [ children: [
@ -254,53 +161,137 @@ class _TrendCardState extends State<TrendCard> {
), ),
], ],
), ),
],
),
],
),
),
],
),
Positioned( Positioned(
right: 0, right: 0,
bottom: 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( child: InkWell(
onTap: () { onTap: () {
setState(() {
_isLike = !_isLike; _isLike = !_isLike;
}); cancelFunc();
setState(() {});
}, },
child: Icon( child: Row(
_isLike ? AntDesign.heart : AntDesign.hearto, mainAxisAlignment: MainAxisAlignment.center,
color: children: [
_isLike ? Color(0xffff6666) : Color(0xffd8d8d8), Icon(
size: 36.sp, _isLike
? AntDesign.heart
: AntDesign.hearto,
color: _isLike
? Color(0xffff6666)
: Colors.black,
size: 32.w,
),
10.wb,
''
.text
.color(ktextPrimary)
.size(28.sp)
.make(),
],
), ),
), ),
), ),
Positioned( Expanded(
right: 35, child: VerticalDivider(
bottom: 0, width: 0,
thickness: 1.w,
color: Color(0xFF979797),
),
),
Expanded(
child: InkWell( child: InkWell(
onTap: () {}, onTap: () {},
child: Icon( child: Row(
AntDesign.message1, mainAxisAlignment: MainAxisAlignment.center,
color: Color(0xffd8d8d8), children: [
size: 36.sp, 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( child: Icon(
MaterialIcons.more, MaterialIcons.more,
color: Color(0xffd8d8d8), 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, bottom: 22.w,
right: 32.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 name: cupertino_icons
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.1.3" version: "1.0.0"
dart_style: dart_style:
dependency: transitive dependency: transitive
description: description:

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

Loading…
Cancel
Save