Merge branch 'master' of http://192.168.2.201:8099/laiiihz/akuCommunity
commit
88d563c7d6
@ -0,0 +1,84 @@
|
|||||||
|
import 'package:akuCommunity/base/base_style.dart';
|
||||||
|
import 'package:akuCommunity/constants/api.dart';
|
||||||
|
import 'package:akuCommunity/utils/headers.dart';
|
||||||
|
import 'package:akuCommunity/utils/network/base_model.dart';
|
||||||
|
import 'package:akuCommunity/utils/network/net_util.dart';
|
||||||
|
import 'package:akuCommunity/widget/bee_scaffold.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:velocity_x/velocity_x.dart';
|
||||||
|
|
||||||
|
class AdviceEvaluatePage extends StatefulWidget {
|
||||||
|
final int id;
|
||||||
|
AdviceEvaluatePage({Key key, @required this.id}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_AdviceEvaluatePageState createState() => _AdviceEvaluatePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AdviceEvaluatePageState extends State<AdviceEvaluatePage> {
|
||||||
|
int _rating = 10;
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BeeScaffold(
|
||||||
|
title: '评价',
|
||||||
|
body: ListView(
|
||||||
|
padding: EdgeInsets.all(32.w),
|
||||||
|
children: [
|
||||||
|
VxBox(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
'请您对本次服务进行评价'.text.size(28.sp).color(Color(0xFF999999)).make(),
|
||||||
|
50.hb,
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
'综合评价'.text.size(28.sp).color(Color(0xFF999999)).make(),
|
||||||
|
50.wb,
|
||||||
|
RatingBar.builder(
|
||||||
|
initialRating: _rating / 2,
|
||||||
|
minRating: 0.5,
|
||||||
|
direction: Axis.horizontal,
|
||||||
|
allowHalfRating: true,
|
||||||
|
itemCount: 5,
|
||||||
|
// itemPadding: EdgeInsets.symmetric(horizontal: 16.w),
|
||||||
|
itemBuilder: (context, _) => Icon(
|
||||||
|
Icons.star_border_rounded,
|
||||||
|
color: kPrimaryColor,
|
||||||
|
),
|
||||||
|
itemSize: 64.w,
|
||||||
|
onRatingUpdate: (rating) {
|
||||||
|
_rating = (rating * 2).floor();
|
||||||
|
},
|
||||||
|
glow: false,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
).padding(EdgeInsets.all(32.w)).white.make(),
|
||||||
|
42.hb,
|
||||||
|
MaterialButton(
|
||||||
|
height: 96.w,
|
||||||
|
shape: StadiumBorder(),
|
||||||
|
color: kPrimaryColor,
|
||||||
|
elevation: 0,
|
||||||
|
onPressed: () async {
|
||||||
|
BaseModel baseModel = await NetUtil().post(
|
||||||
|
API.manager.adviceEvaluate,
|
||||||
|
params: {'id': widget.id, 'score': _rating},
|
||||||
|
showMessage: true,
|
||||||
|
);
|
||||||
|
if (baseModel.status) {
|
||||||
|
Get.back();
|
||||||
|
Get.back();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: '确认'.text.bold.size(32.sp).make(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class AnimatedScale extends ImplicitlyAnimatedWidget {
|
||||||
|
final Widget child;
|
||||||
|
final double scale;
|
||||||
|
|
||||||
|
AnimatedScale({this.child, this.scale})
|
||||||
|
: super(
|
||||||
|
duration: Duration(milliseconds: 300),
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
ImplicitlyAnimatedWidgetState<ImplicitlyAnimatedWidget> createState() =>
|
||||||
|
_AnimatedScaleState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AnimatedScaleState extends AnimatedWidgetBaseState<AnimatedScale> {
|
||||||
|
Tween<double> scaleTween;
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Transform.scale(
|
||||||
|
scale: scaleTween.evaluate(animation),
|
||||||
|
child: widget.child,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void forEachTween(visitor) {
|
||||||
|
scaleTween = visitor(
|
||||||
|
scaleTween,
|
||||||
|
widget.scale,
|
||||||
|
(value) => Tween<double>(begin: value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class AnimatedTranslate extends ImplicitlyAnimatedWidget {
|
||||||
|
final Widget child;
|
||||||
|
final Offset offset;
|
||||||
|
|
||||||
|
AnimatedTranslate({this.child, this.offset})
|
||||||
|
: super(
|
||||||
|
duration: Duration(milliseconds: 300),
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
ImplicitlyAnimatedWidgetState<ImplicitlyAnimatedWidget> createState() =>
|
||||||
|
_AnimatedTranslateState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AnimatedTranslateState
|
||||||
|
extends AnimatedWidgetBaseState<AnimatedTranslate> {
|
||||||
|
Tween<Offset> _offsetTween;
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Transform.translate(
|
||||||
|
offset: _offsetTween.evaluate(animation),
|
||||||
|
child: widget.child,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void forEachTween(visitor) {
|
||||||
|
_offsetTween = visitor(
|
||||||
|
_offsetTween,
|
||||||
|
widget.offset,
|
||||||
|
(value) => Tween<Offset>(begin: value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
import 'package:akuCommunity/base/base_style.dart';
|
||||||
|
import 'package:akuCommunity/utils/headers.dart';
|
||||||
|
import 'package:akuCommunity/widget/animated/animated_scale.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class BeeRadio<T> extends StatefulWidget {
|
||||||
|
final T value;
|
||||||
|
final List<T> groupValues;
|
||||||
|
BeeRadio({Key key, @required this.value, @required this.groupValues})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_BeeRadioState createState() => _BeeRadioState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _BeeRadioState extends State<BeeRadio> {
|
||||||
|
bool get _selected {
|
||||||
|
if (widget.groupValues.contains(widget.value)) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AnimatedContainer(
|
||||||
|
height: 40.w,
|
||||||
|
width: 40.w,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(
|
||||||
|
color: _selected ? kPrimaryColor : Color(0xFF979797),
|
||||||
|
width: 3.w,
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(20.w),
|
||||||
|
),
|
||||||
|
duration: Duration(milliseconds: 300),
|
||||||
|
curve: Curves.easeInOutCubic,
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: AnimatedOpacity(
|
||||||
|
duration: Duration(milliseconds: 300),
|
||||||
|
curve: Curves.easeInOutCubic,
|
||||||
|
opacity: _selected ? 1 : 0,
|
||||||
|
child: AnimatedScale(
|
||||||
|
scale: _selected ? 1 : 0,
|
||||||
|
child: Container(
|
||||||
|
height: 24.w,
|
||||||
|
width: 24.w,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: kPrimaryColor,
|
||||||
|
borderRadius: BorderRadius.circular(12.w),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue