|
@@ -40,13 +40,17 @@ class _PageState extends State<FeedbackPage> with InjectLoginApi, InjectApi {
|
|
|
FocusNode _focusNode;
|
|
|
var _posting = false;
|
|
|
int joinTime = 0;
|
|
|
+ ValueNotifier<bool> _postable = ValueNotifier(false);
|
|
|
|
|
|
@override
|
|
|
void initState() {
|
|
|
initData();
|
|
|
|
|
|
_focusNode = FocusNode();
|
|
|
- _controller = TextEditingController();
|
|
|
+ _controller = TextEditingController()
|
|
|
+ ..addListener(() {
|
|
|
+ _postable.value = _controller.value.text.isNotEmpty;
|
|
|
+ });
|
|
|
|
|
|
_isLoading = true;
|
|
|
super.initState();
|
|
@@ -85,7 +89,10 @@ class _PageState extends State<FeedbackPage> with InjectLoginApi, InjectApi {
|
|
|
list.insert(index, FeedBackInfoData(from: "-1", createTime: now));
|
|
|
list.insert(index, FeedBackInfoData(from: "-2", createTime: now));
|
|
|
} else {
|
|
|
- list = [FeedBackInfoData(from: "-1", createTime: now), FeedBackInfoData(from: "-2", createTime: now)];
|
|
|
+ list = [
|
|
|
+ FeedBackInfoData(from: "-1", createTime: now),
|
|
|
+ FeedBackInfoData(from: "-2", createTime: now)
|
|
|
+ ];
|
|
|
joinTime = now;
|
|
|
}
|
|
|
|
|
@@ -96,7 +103,8 @@ class _PageState extends State<FeedbackPage> with InjectLoginApi, InjectApi {
|
|
|
if (t == 0) {
|
|
|
t = e.createTime;
|
|
|
}
|
|
|
- print("$t ${e.createTime} ${day} ${e.createTime + day} ${t > e.createTime + day}");
|
|
|
+ print(
|
|
|
+ "$t ${e.createTime} ${day} ${e.createTime + day} ${t > e.createTime + day}");
|
|
|
if (t > e.createTime + day) {
|
|
|
fixed.add(FeedBackInfoData(from: "-3", createTime: t));
|
|
|
}
|
|
@@ -104,7 +112,8 @@ class _PageState extends State<FeedbackPage> with InjectLoginApi, InjectApi {
|
|
|
t = e.createTime;
|
|
|
}
|
|
|
if (fixed.length > 2) {
|
|
|
- fixed.add(FeedBackInfoData(from: "-3", createTime: fixed[fixed.length - 1].createTime));
|
|
|
+ fixed.add(FeedBackInfoData(
|
|
|
+ from: "-3", createTime: fixed[fixed.length - 1].createTime));
|
|
|
}
|
|
|
|
|
|
data.data = fixed;
|
|
@@ -127,177 +136,249 @@ class _PageState extends State<FeedbackPage> with InjectLoginApi, InjectApi {
|
|
|
builder: (context, model, child) {
|
|
|
return _isLoading
|
|
|
? RequestLoadingWidget()
|
|
|
- : CustomScrollView(reverse: (_data.data?.length ?? 0) > 2, slivers: [
|
|
|
- SliverList(
|
|
|
- delegate: SliverChildListDelegate(
|
|
|
- _data.data
|
|
|
- .map((e) => e.from == "-3"
|
|
|
- ? Center(
|
|
|
- child: Padding(
|
|
|
- padding: EdgeInsets.symmetric(vertical: 8.0),
|
|
|
- child: Text(
|
|
|
- "${DateFormat.formatTime(e.createTime)}",
|
|
|
- style: Theme.of(context).textTheme.bodyText1,
|
|
|
- )),
|
|
|
- )
|
|
|
- : e.from == "-1"
|
|
|
- ? Padding(
|
|
|
- padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 12.0),
|
|
|
- child: Row(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
- children: <Widget>[
|
|
|
- CircleAvatar(
|
|
|
- backgroundImage: CachedNetworkImageProvider(
|
|
|
- "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2661558467,1288211245&fm=26&gp=0.jpg"),
|
|
|
- radius: 20,
|
|
|
- ),
|
|
|
- Space(
|
|
|
- width: 12,
|
|
|
- ),
|
|
|
- CustomPaint(
|
|
|
- painter: _BubblePainter(),
|
|
|
- child: Padding(
|
|
|
- padding: const EdgeInsets.fromLTRB(20.0, 8.0, 12, 8),
|
|
|
- child: Container(
|
|
|
- child: Text(
|
|
|
- "很高兴认识你",
|
|
|
- style: Theme.of(context).textTheme.subtitle1.copyWith(fontSize: 16),
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- )
|
|
|
- ],
|
|
|
- ),
|
|
|
+ : CustomScrollView(
|
|
|
+ reverse: (_data.data?.length ?? 0) > 2,
|
|
|
+ slivers: [
|
|
|
+ SliverList(
|
|
|
+ delegate: SliverChildListDelegate(
|
|
|
+ _data.data
|
|
|
+ .map((e) => e.from == "-3"
|
|
|
+ ? Center(
|
|
|
+ child: Padding(
|
|
|
+ padding:
|
|
|
+ EdgeInsets.symmetric(
|
|
|
+ vertical: 8.0),
|
|
|
+ child: Text(
|
|
|
+ "${DateFormat.formatTime(e.createTime)}",
|
|
|
+ style: Theme.of(context)
|
|
|
+ .textTheme
|
|
|
+ .bodyText1,
|
|
|
+ )),
|
|
|
)
|
|
|
- : e.from == "-2"
|
|
|
+ : e.from == "-1"
|
|
|
? Padding(
|
|
|
- padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 12.0),
|
|
|
+ padding: const EdgeInsets
|
|
|
+ .symmetric(
|
|
|
+ vertical: 8.0,
|
|
|
+ horizontal: 12.0),
|
|
|
child: Row(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ crossAxisAlignment:
|
|
|
+ CrossAxisAlignment
|
|
|
+ .start,
|
|
|
children: <Widget>[
|
|
|
CircleAvatar(
|
|
|
- backgroundImage: CachedNetworkImageProvider(
|
|
|
- "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2661558467,1288211245&fm=26&gp=0.jpg"),
|
|
|
+ backgroundImage:
|
|
|
+ CachedNetworkImageProvider(
|
|
|
+ "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2661558467,1288211245&fm=26&gp=0.jpg"),
|
|
|
radius: 20,
|
|
|
),
|
|
|
Space(
|
|
|
width: 12,
|
|
|
),
|
|
|
CustomPaint(
|
|
|
- painter: _BubblePainter(),
|
|
|
+ painter:
|
|
|
+ _BubblePainter(),
|
|
|
child: Padding(
|
|
|
- padding: const EdgeInsets.fromLTRB(20.0, 8.0, 12, 8),
|
|
|
+ padding:
|
|
|
+ const EdgeInsets
|
|
|
+ .fromLTRB(
|
|
|
+ 20.0,
|
|
|
+ 8.0,
|
|
|
+ 12,
|
|
|
+ 8),
|
|
|
child: Container(
|
|
|
- child: Column(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
- children: <Widget>[
|
|
|
- Text(
|
|
|
- "常见问题",
|
|
|
- style: Theme.of(context).textTheme.subtitle1.copyWith(fontSize: 16),
|
|
|
- ),
|
|
|
- Column(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
- children: model.data.data
|
|
|
- .map((e) => InkWell(
|
|
|
- onTap: () {
|
|
|
- NavigatorUtil.goPage(context, (context) => FeedbackDetailPage(e));
|
|
|
- // NavigatorUtil.go(context, "${Routes.feedbackDetail}?data=${Uri.encodeComponent(json.encode(e))}");
|
|
|
- },
|
|
|
- child: Padding(
|
|
|
- padding: EdgeInsets.symmetric(vertical: 5.0),
|
|
|
- child: Text("${model.data.data.indexOf(e) + 1}.${e.groupName}",
|
|
|
- style: Theme.of(context)
|
|
|
- .textTheme
|
|
|
- .subtitle1
|
|
|
- .copyWith(color: Color(0xff666666), fontSize: 16)),
|
|
|
- )))
|
|
|
- .toList(),
|
|
|
- ),
|
|
|
- ],
|
|
|
- )),
|
|
|
+ child: Text(
|
|
|
+ "很高兴认识你",
|
|
|
+ style: Theme.of(
|
|
|
+ context)
|
|
|
+ .textTheme
|
|
|
+ .subtitle1
|
|
|
+ .copyWith(
|
|
|
+ fontSize:
|
|
|
+ 16),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
),
|
|
|
- ),
|
|
|
+ )
|
|
|
],
|
|
|
),
|
|
|
)
|
|
|
- : Padding(
|
|
|
- padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 12.0),
|
|
|
- child: Row(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
- mainAxisAlignment: e.from == "user" ? MainAxisAlignment.end : MainAxisAlignment.start,
|
|
|
- children: e.from == "user"
|
|
|
- ? <Widget>[
|
|
|
- CustomPaint(
|
|
|
- painter: _BubblePainterRight(),
|
|
|
- child: ConstrainedBox(
|
|
|
- constraints: BoxConstraints(maxWidth: MediaQuery.of(context).size.width * 0.6),
|
|
|
- child: Container(
|
|
|
- padding: EdgeInsets.fromLTRB(12, 6, 20, 8),
|
|
|
- child: Column(
|
|
|
- children: <Widget>[
|
|
|
- Text(
|
|
|
- "${e.content}",
|
|
|
- style: Theme.of(context)
|
|
|
- .textTheme
|
|
|
- .subtitle1
|
|
|
- .copyWith(fontSize: 16, color: Colors.white),
|
|
|
- ),
|
|
|
- if (e.images?.isNotEmpty == true)
|
|
|
- GridView.count(
|
|
|
- physics: new NeverScrollableScrollPhysics(),
|
|
|
- shrinkWrap: true,
|
|
|
- padding: EdgeInsets.zero,
|
|
|
- crossAxisSpacing: 10.0,
|
|
|
- crossAxisCount: e.images?.length ?? 0,
|
|
|
- children: e.images
|
|
|
- .asMap()
|
|
|
- .keys
|
|
|
- .map((i) => CachedNetworkImage(
|
|
|
- imageUrl: e.images[i],
|
|
|
- fit: BoxFit.cover,
|
|
|
- ))
|
|
|
- .toList())
|
|
|
- ],
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
- ),
|
|
|
+ : e.from == "-2"
|
|
|
+ ? Padding(
|
|
|
+ padding:
|
|
|
+ const EdgeInsets
|
|
|
+ .symmetric(
|
|
|
+ vertical: 8.0,
|
|
|
+ horizontal:
|
|
|
+ 12.0),
|
|
|
+ child: Row(
|
|
|
+ crossAxisAlignment:
|
|
|
+ CrossAxisAlignment
|
|
|
+ .start,
|
|
|
+ children: <Widget>[
|
|
|
+ CircleAvatar(
|
|
|
+ backgroundImage:
|
|
|
+ CachedNetworkImageProvider(
|
|
|
+ "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2661558467,1288211245&fm=26&gp=0.jpg"),
|
|
|
+ radius: 20,
|
|
|
+ ),
|
|
|
+ Space(
|
|
|
+ width: 12,
|
|
|
+ ),
|
|
|
+ CustomPaint(
|
|
|
+ painter:
|
|
|
+ _BubblePainter(),
|
|
|
+ child: Padding(
|
|
|
+ padding:
|
|
|
+ const EdgeInsets
|
|
|
+ .fromLTRB(
|
|
|
+ 20.0,
|
|
|
+ 8.0,
|
|
|
+ 12,
|
|
|
+ 8),
|
|
|
+ child: Container(
|
|
|
+ child: Column(
|
|
|
+ crossAxisAlignment:
|
|
|
+ CrossAxisAlignment
|
|
|
+ .start,
|
|
|
+ children: <
|
|
|
+ Widget>[
|
|
|
+ Text(
|
|
|
+ "常见问题",
|
|
|
+ style: Theme.of(
|
|
|
+ context)
|
|
|
+ .textTheme
|
|
|
+ .subtitle1
|
|
|
+ .copyWith(
|
|
|
+ fontSize: 16),
|
|
|
),
|
|
|
- )),
|
|
|
- Space(
|
|
|
- width: 12,
|
|
|
- ),
|
|
|
- CircleAvatar(
|
|
|
- backgroundImage: userAvatarProvider(_user?.avatar),
|
|
|
- radius: 20,
|
|
|
- ),
|
|
|
- ]
|
|
|
- : <Widget>[
|
|
|
- CircleAvatar(
|
|
|
- backgroundImage: CachedNetworkImageProvider(
|
|
|
- "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2661558467,1288211245&fm=26&gp=0.jpg"),
|
|
|
- radius: 20,
|
|
|
- ),
|
|
|
- Space(
|
|
|
- width: 12,
|
|
|
+ Column(
|
|
|
+ crossAxisAlignment:
|
|
|
+ CrossAxisAlignment
|
|
|
+ .start,
|
|
|
+ children: model
|
|
|
+ .data
|
|
|
+ .data
|
|
|
+ .map((e) => InkWell(
|
|
|
+ onTap: () {
|
|
|
+ NavigatorUtil.goPage(context, (context) => FeedbackDetailPage(e));
|
|
|
+ // NavigatorUtil.go(context, "${Routes.feedbackDetail}?data=${Uri.encodeComponent(json.encode(e))}");
|
|
|
+ },
|
|
|
+ child: Padding(
|
|
|
+ padding: EdgeInsets.symmetric(vertical: 5.0),
|
|
|
+ child: Text("${model.data.data.indexOf(e) + 1}.${e.groupName}", style: Theme.of(context).textTheme.subtitle1.copyWith(color: Color(0xff666666), fontSize: 16)),
|
|
|
+ )))
|
|
|
+ .toList(),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ )),
|
|
|
),
|
|
|
- CustomPaint(
|
|
|
- painter: _BubblePainter(),
|
|
|
- child: ConstrainedBox(
|
|
|
- constraints: BoxConstraints(maxWidth: MediaQuery.of(context).size.width * 0.6),
|
|
|
- child: Container(
|
|
|
- padding: EdgeInsets.fromLTRB(12, 6, 20, 8),
|
|
|
- child: Text(
|
|
|
- "${e.content}",
|
|
|
- style: Theme.of(context).textTheme.subtitle1.copyWith(fontSize: 16),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ : Padding(
|
|
|
+ padding:
|
|
|
+ const EdgeInsets
|
|
|
+ .symmetric(
|
|
|
+ vertical: 8.0,
|
|
|
+ horizontal:
|
|
|
+ 12.0),
|
|
|
+ child: Row(
|
|
|
+ crossAxisAlignment:
|
|
|
+ CrossAxisAlignment
|
|
|
+ .start,
|
|
|
+ mainAxisAlignment: e
|
|
|
+ .from ==
|
|
|
+ "user"
|
|
|
+ ? MainAxisAlignment
|
|
|
+ .end
|
|
|
+ : MainAxisAlignment
|
|
|
+ .start,
|
|
|
+ children:
|
|
|
+ e.from == "user"
|
|
|
+ ? <Widget>[
|
|
|
+ CustomPaint(
|
|
|
+ painter:
|
|
|
+ _BubblePainterRight(),
|
|
|
+ child:
|
|
|
+ ConstrainedBox(
|
|
|
+ constraints:
|
|
|
+ BoxConstraints(maxWidth: MediaQuery.of(context).size.width * 0.6),
|
|
|
+ child:
|
|
|
+ Container(
|
|
|
+ padding: EdgeInsets.fromLTRB(12, 6, 20, 8),
|
|
|
+ child: Column(
|
|
|
+ children: <Widget>[
|
|
|
+ Text(
|
|
|
+ "${e.content}",
|
|
|
+ style: Theme.of(context).textTheme.subtitle1.copyWith(fontSize: 16, color: Color(0xff333333)),
|
|
|
+ ),
|
|
|
+ if (e.images?.isNotEmpty == true)
|
|
|
+ GridView.count(
|
|
|
+ physics: new NeverScrollableScrollPhysics(),
|
|
|
+ shrinkWrap: true,
|
|
|
+ padding: EdgeInsets.zero,
|
|
|
+ crossAxisSpacing: 10.0,
|
|
|
+ crossAxisCount: e.images?.length ?? 0,
|
|
|
+ children: e.images
|
|
|
+ .asMap()
|
|
|
+ .keys
|
|
|
+ .map((i) => CachedNetworkImage(
|
|
|
+ imageUrl: e.images[i],
|
|
|
+ fit: BoxFit.cover,
|
|
|
+ ))
|
|
|
+ .toList())
|
|
|
+ ],
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ )),
|
|
|
+ Space(
|
|
|
+ width:
|
|
|
+ 12,
|
|
|
),
|
|
|
- ),
|
|
|
- )),
|
|
|
- ],
|
|
|
- ),
|
|
|
- ))
|
|
|
- .toList(),
|
|
|
- ),
|
|
|
- )
|
|
|
- ]);
|
|
|
+ CircleAvatar(
|
|
|
+ backgroundImage:
|
|
|
+ userAvatarProvider(_user?.avatar),
|
|
|
+ radius:
|
|
|
+ 20,
|
|
|
+ ),
|
|
|
+ ]
|
|
|
+ : <Widget>[
|
|
|
+ CircleAvatar(
|
|
|
+ backgroundImage:
|
|
|
+ CachedNetworkImageProvider("https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2661558467,1288211245&fm=26&gp=0.jpg"),
|
|
|
+ radius:
|
|
|
+ 20,
|
|
|
+ ),
|
|
|
+ Space(
|
|
|
+ width:
|
|
|
+ 12,
|
|
|
+ ),
|
|
|
+ CustomPaint(
|
|
|
+ painter:
|
|
|
+ _BubblePainter(),
|
|
|
+ child:
|
|
|
+ ConstrainedBox(
|
|
|
+ constraints:
|
|
|
+ BoxConstraints(maxWidth: MediaQuery.of(context).size.width * 0.6),
|
|
|
+ child:
|
|
|
+ Container(
|
|
|
+ padding: EdgeInsets.fromLTRB(12, 6, 20, 8),
|
|
|
+ child: Text(
|
|
|
+ "${e.content}",
|
|
|
+ style: Theme.of(context).textTheme.subtitle1.copyWith(fontSize: 16),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ )),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ))
|
|
|
+ .toList(),
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ]);
|
|
|
},
|
|
|
),
|
|
|
),
|
|
@@ -313,8 +394,10 @@ class _PageState extends State<FeedbackPage> with InjectLoginApi, InjectApi {
|
|
|
_postImage();
|
|
|
},
|
|
|
child: Padding(
|
|
|
- padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 12.0),
|
|
|
- child: Image.asset("lib/assets/img/bbs_icon_picture.png"),
|
|
|
+ padding: const EdgeInsets.symmetric(
|
|
|
+ vertical: 8.0, horizontal: 12.0),
|
|
|
+ child:
|
|
|
+ Image.asset("lib/assets/img/bbs_icon_picture.png"),
|
|
|
),
|
|
|
),
|
|
|
Expanded(
|
|
@@ -323,17 +406,25 @@ class _PageState extends State<FeedbackPage> with InjectLoginApi, InjectApi {
|
|
|
controller: _controller,
|
|
|
focusNode: _focusNode,
|
|
|
keyboardType: TextInputType.multiline,
|
|
|
- strutStyle: StrutStyle(forceStrutHeight: true, height: 1.4),
|
|
|
+ strutStyle:
|
|
|
+ StrutStyle(forceStrutHeight: true, height: 1.4),
|
|
|
minLines: 1,
|
|
|
maxLines: 3,
|
|
|
maxLength: 200,
|
|
|
+ style: TextStyle(fontSize: 16.0),
|
|
|
onChanged: (value) {
|
|
|
- setState(() {
|
|
|
+ setState(() {
|
|
|
_textFieldValue = value;
|
|
|
- });
|
|
|
+ });
|
|
|
},
|
|
|
decoration: InputDecoration(
|
|
|
- counterText: "", hintText: "提交你的反馈...", contentPadding: EdgeInsets.symmetric(vertical: 16.0), border: InputBorder.none),
|
|
|
+ counterText: "",
|
|
|
+ hintText: "提交你的反馈...",
|
|
|
+ contentPadding:
|
|
|
+ EdgeInsets.symmetric(vertical: 16.0),
|
|
|
+ border: InputBorder.none,
|
|
|
+ hintStyle: TextStyle(color: Color(0xff999999))
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
@@ -345,18 +436,21 @@ class _PageState extends State<FeedbackPage> with InjectLoginApi, InjectApi {
|
|
|
width: 22,
|
|
|
child: CircularProgressIndicator(),
|
|
|
)
|
|
|
- : PrimaryButton(
|
|
|
- width: 80,
|
|
|
- height: 35,
|
|
|
- callback: _textFieldValue.isEmpty
|
|
|
- ? null
|
|
|
- : () async {
|
|
|
+ :
|
|
|
+ ValueListenableBuilder(
|
|
|
+ valueListenable: _postable,
|
|
|
+ builder: (_, able, __) => PrimaryButton(
|
|
|
+ content: "提交",
|
|
|
+ width: 80,
|
|
|
+ height: 35,
|
|
|
+ callback: () async {
|
|
|
setState(() {
|
|
|
_posting = true;
|
|
|
});
|
|
|
_controller.clear();
|
|
|
|
|
|
- await _postFeedBackpostFeedBack(_textFieldValue);
|
|
|
+ await _postFeedBackpostFeedBack(
|
|
|
+ _textFieldValue);
|
|
|
// ToastUtil.show("提交成功");
|
|
|
|
|
|
setState(() {
|
|
@@ -364,10 +458,12 @@ class _PageState extends State<FeedbackPage> with InjectLoginApi, InjectApi {
|
|
|
_posting = false;
|
|
|
});
|
|
|
refresh();
|
|
|
-// SystemChannels.textInput.invokeMethod('TextInput.hide');
|
|
|
},
|
|
|
- content: "提交",
|
|
|
- ),
|
|
|
+ shadow: able == true,
|
|
|
+ buttonColor: able == false
|
|
|
+ ? Color(0xffFFC400).withOpacity(0.3)
|
|
|
+ : null,
|
|
|
+ )),
|
|
|
)
|
|
|
],
|
|
|
),
|
|
@@ -412,7 +508,8 @@ class _PageState extends State<FeedbackPage> with InjectLoginApi, InjectApi {
|
|
|
|
|
|
_postFeedBackpostFeedBack(String content, {int typeId = 0}) async {
|
|
|
typeId == null ? typeId = 0 : typeId = typeId;
|
|
|
- await api.postFeedback(typeId, content, extra: await Application.getDeviceInfo());
|
|
|
+ await api.postFeedback(typeId, content,
|
|
|
+ extra: await Application.getDeviceInfo());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -459,7 +556,8 @@ class PostActionState extends State<PostAction> with InjectApi {
|
|
|
Asset asset = imageList[i];
|
|
|
if (upload.containsKey(asset)) continue;
|
|
|
ByteData byteData = await asset.getByteData(quality: 85);
|
|
|
- File file = File('${directory.path}/${DateTime.now().millisecondsSinceEpoch}_$i.jpg');
|
|
|
+ File file = File(
|
|
|
+ '${directory.path}/${DateTime.now().millisecondsSinceEpoch}_$i.jpg');
|
|
|
List<int> bytes = byteData.buffer.asUint8List().toList();
|
|
|
print('临时文件 ${file.path} ${bytes.length}');
|
|
|
file.writeAsBytesSync(bytes);
|
|
@@ -474,7 +572,9 @@ class PostActionState extends State<PostAction> with InjectApi {
|
|
|
|
|
|
_msg.value = "发布中...";
|
|
|
// await Future.delayed(Duration(seconds: 3));
|
|
|
- var data = await api.postFeedback(0, '图片', images: json.encode(upload.values.toList()), extra: await Application.getDeviceInfo());
|
|
|
+ var data = await api.postFeedback(0, '图片',
|
|
|
+ images: json.encode(upload.values.toList()),
|
|
|
+ extra: await Application.getDeviceInfo());
|
|
|
print(data);
|
|
|
if (data.code == 0) {
|
|
|
Navigator.of(context).pop(true);
|
|
@@ -492,7 +592,10 @@ class PostActionState extends State<PostAction> with InjectApi {
|
|
|
CircularProgressIndicator(),
|
|
|
Padding(
|
|
|
padding: const EdgeInsets.only(top: 15),
|
|
|
- child: ValueListenableBuilder(valueListenable: _msg, builder: (BuildContext context, String value, Widget child) => Text(value)),
|
|
|
+ child: ValueListenableBuilder(
|
|
|
+ valueListenable: _msg,
|
|
|
+ builder: (BuildContext context, String value, Widget child) =>
|
|
|
+ Text(value)),
|
|
|
)
|
|
|
],
|
|
|
),
|
|
@@ -500,6 +603,55 @@ class PostActionState extends State<PostAction> with InjectApi {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+//class _BubblePainter extends CustomPainter {
|
|
|
+// final circular = Radius.circular(10);
|
|
|
+// final Paint _paint = Paint()..color = Colors.white;
|
|
|
+// final double _bubbleWidth = 10;
|
|
|
+//
|
|
|
+// @override
|
|
|
+// void paint(Canvas canvas, Size size) {
|
|
|
+//// Path path = Path()..moveTo(size.width, size.height / 2)..quadraticBezierTo(size.width / 3*2, size.height / 2 + 50, 0, size.height / 2)
|
|
|
+//// ..quadraticBezierTo(size.width / 3, size.height,size.width,size.height)..close();
|
|
|
+// Path path = Path()
|
|
|
+// ..moveTo(_bubbleWidth + 1, _bubbleWidth)
|
|
|
+// ..quadraticBezierTo(_bubbleWidth / 3 * 2, _bubbleWidth + 4, 0, _bubbleWidth)
|
|
|
+// ..quadraticBezierTo(_bubbleWidth / 3, _bubbleWidth + _bubbleWidth / 2, _bubbleWidth + 1, _bubbleWidth * 2)
|
|
|
+// ..close();
|
|
|
+// canvas.drawPath(path, _paint);
|
|
|
+// canvas.drawRRect(RRect.fromLTRBR(_bubbleWidth, 0, size.width, size.height, circular), _paint);
|
|
|
+// }
|
|
|
+//
|
|
|
+// @override
|
|
|
+// bool shouldRepaint(CustomPainter oldDelegate) {
|
|
|
+// return oldDelegate != this;
|
|
|
+// }
|
|
|
+//}
|
|
|
+//
|
|
|
+//class _BubblePainterRight extends CustomPainter {
|
|
|
+// final circular = Radius.circular(10);
|
|
|
+// final Paint _paint = Paint()..color = Color(0xffFFC400);
|
|
|
+// final double _bubbleWidth = 10;
|
|
|
+//
|
|
|
+// @override
|
|
|
+// void paint(Canvas canvas, Size size) {
|
|
|
+//// Path path = Path()..moveTo(size.width, size.height / 2)..quadraticBezierTo(size.width / 3*2, size.height / 2 + 50, 0, size.height / 2)
|
|
|
+//// ..quadraticBezierTo(size.width / 3, size.height,size.width,size.height)..close();
|
|
|
+// double left = size.width - _bubbleWidth;
|
|
|
+// Path path = Path()
|
|
|
+// ..moveTo(left, _bubbleWidth)
|
|
|
+// ..quadraticBezierTo(left + _bubbleWidth / 3 * 2, _bubbleWidth + 4, size.width, _bubbleWidth)
|
|
|
+// ..quadraticBezierTo(left + _bubbleWidth / 3, _bubbleWidth + _bubbleWidth / 2, left, _bubbleWidth * 2)
|
|
|
+// ..close();
|
|
|
+// canvas.drawPath(path, _paint);
|
|
|
+// canvas.drawRRect(RRect.fromLTRBR(0, 0, size.width - _bubbleWidth, size.height, circular), _paint);
|
|
|
+// }
|
|
|
+//
|
|
|
+// @override
|
|
|
+// bool shouldRepaint(CustomPainter oldDelegate) {
|
|
|
+// return oldDelegate != this;
|
|
|
+// }
|
|
|
+//}
|
|
|
+
|
|
|
class _BubblePainter extends CustomPainter {
|
|
|
final circular = Radius.circular(10);
|
|
|
final Paint _paint = Paint()..color = Colors.white;
|
|
@@ -511,11 +663,15 @@ class _BubblePainter extends CustomPainter {
|
|
|
// ..quadraticBezierTo(size.width / 3, size.height,size.width,size.height)..close();
|
|
|
Path path = Path()
|
|
|
..moveTo(_bubbleWidth + 1, _bubbleWidth)
|
|
|
- ..quadraticBezierTo(_bubbleWidth / 3 * 2, _bubbleWidth + 4, 0, _bubbleWidth)
|
|
|
- ..quadraticBezierTo(_bubbleWidth / 3, _bubbleWidth + _bubbleWidth / 2, _bubbleWidth + 1, _bubbleWidth * 2)
|
|
|
+ ..quadraticBezierTo(
|
|
|
+ _bubbleWidth / 3 * 2, _bubbleWidth + 4, 0, _bubbleWidth)
|
|
|
+ ..quadraticBezierTo(_bubbleWidth / 3, _bubbleWidth + _bubbleWidth / 2,
|
|
|
+ _bubbleWidth + 1, _bubbleWidth * 2)
|
|
|
..close();
|
|
|
canvas.drawPath(path, _paint);
|
|
|
- canvas.drawRRect(RRect.fromLTRBR(_bubbleWidth, 0, size.width, size.height, circular), _paint);
|
|
|
+ canvas.drawRRect(
|
|
|
+ RRect.fromLTRBR(_bubbleWidth, 0, size.width, size.height, circular),
|
|
|
+ _paint);
|
|
|
}
|
|
|
|
|
|
@override
|
|
@@ -526,7 +682,7 @@ class _BubblePainter extends CustomPainter {
|
|
|
|
|
|
class _BubblePainterRight extends CustomPainter {
|
|
|
final circular = Radius.circular(10);
|
|
|
- final Paint _paint = Paint()..color = Color(0xffFFC400);
|
|
|
+ final Paint _paint = Paint()..color = Color(0xffffe400).withOpacity(0.7);
|
|
|
final double _bubbleWidth = 10;
|
|
|
|
|
|
@override
|
|
@@ -536,11 +692,15 @@ class _BubblePainterRight extends CustomPainter {
|
|
|
double left = size.width - _bubbleWidth;
|
|
|
Path path = Path()
|
|
|
..moveTo(left, _bubbleWidth)
|
|
|
- ..quadraticBezierTo(left + _bubbleWidth / 3 * 2, _bubbleWidth + 4, size.width, _bubbleWidth)
|
|
|
- ..quadraticBezierTo(left + _bubbleWidth / 3, _bubbleWidth + _bubbleWidth / 2, left, _bubbleWidth * 2)
|
|
|
+ ..quadraticBezierTo(left + _bubbleWidth / 3 * 2, _bubbleWidth + 2,
|
|
|
+ size.width, _bubbleWidth)
|
|
|
+ ..quadraticBezierTo(left + _bubbleWidth / 3,
|
|
|
+ _bubbleWidth + _bubbleWidth / 2, left, _bubbleWidth * 2)
|
|
|
..close();
|
|
|
canvas.drawPath(path, _paint);
|
|
|
- canvas.drawRRect(RRect.fromLTRBR(0, 0, size.width - _bubbleWidth, size.height, circular), _paint);
|
|
|
+ canvas.drawRRect(
|
|
|
+ RRect.fromLTRBR(0, 0, size.width - _bubbleWidth, size.height, circular),
|
|
|
+ _paint);
|
|
|
}
|
|
|
|
|
|
@override
|