update animate

hmxc
张萌 4 years ago
parent 819cd13e93
commit df2bc557be

@ -1,12 +1,15 @@
// Flutter imports: // Flutter imports:
import 'package:akuCommunity/pages/manager_func.dart'; import 'package:akuCommunity/pages/manager_func.dart';
import 'package:akuCommunity/provider/user_provider.dart';
import 'package:akuCommunity/widget/buttons/bottom_button.dart'; import 'package:akuCommunity/widget/buttons/bottom_button.dart';
import 'package:akuCommunity/widget/buttons/radio_button.dart'; import 'package:akuCommunity/widget/buttons/radio_button.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// Package imports: // Package imports:
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:provider/provider.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
// Project imports: // Project imports:
@ -62,6 +65,7 @@ class _GoodsDetoPageState extends State<GoodsDetoPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
UserProvider userProvider = Provider.of<UserProvider>(context);
return BeeScaffold( return BeeScaffold(
title: '物品出户', title: '物品出户',
actions: [ actions: [
@ -124,7 +128,9 @@ class _GoodsDetoPageState extends State<GoodsDetoPage> {
_refreshController.callRefresh(); _refreshController.callRefresh();
} }
: () { : () {
DetoCreatePage().to(); userProvider.isLogin
? DetoCreatePage().to()
: BotToast.showText(text: '请先登录!');
}, },
child: _isEdit child: _isEdit
? '删除'.text.size(32.sp).bold.make() ? '删除'.text.size(32.sp).bold.make()

@ -85,7 +85,7 @@ class _FixedSubmitPageState extends State<FixedSubmitPage> {
Widget _buildCard(FixedSubmitModel model) { Widget _buildCard(FixedSubmitModel model) {
return AnimatedPositioned( return AnimatedPositioned(
top: 0, top: 0,
left: (_canSkew(4) && _isEdit) ? 55.w : 0, left: (_canSkew(model.status) && _isEdit) ? 55.w : 0,
bottom: 0, bottom: 0,
duration: Duration(milliseconds: 300), duration: Duration(milliseconds: 300),
curve: Curves.easeInOutCubic, curve: Curves.easeInOutCubic,
@ -159,30 +159,33 @@ class _FixedSubmitPageState extends State<FixedSubmitPage> {
} }
Widget _buildCheckBox(FixedSubmitModel model) { Widget _buildCheckBox(FixedSubmitModel model) {
return GestureDetector( return
onTap: () { // GestureDetector(
if (_selected.contains(model.id)) { // onTap: () {
_selected.remove(model.id); // if (_selected.contains(model.id)) {
} else {
_selected.add(model.id);
}
setState(() {});
},
child: Container(
alignment: Alignment.centerLeft,
constraints: BoxConstraints(minHeight: 384.w, minWidth: 686.w),
// child: FixedCheckBox(
// onChanged: (isSelect) {
// if (isSelect) {
// _selected.add(model.id);
// } else {
// _selected.remove(model.id); // _selected.remove(model.id);
// } else {
// _selected.add(model.id);
// } // }
// setState(() {}); // setState(() {});
// }, // },
// ), // child:
child: BeeRadio(value: model.id, groupValues: _selected), Container(
alignment: Alignment.centerLeft,
constraints: BoxConstraints(minHeight: 384.w, minWidth: 686.w),
child: FixedCheckBox(
key:ValueKey(model.id),
onChanged: (isSelect) {
if (isSelect) {
_selected.add(model.id);
} else {
_selected.remove(model.id);
}
setState(() {});
},
), ),
// child: BeeRadio(value: model.id, groupValues: _selected),
// ),
); );
} }
@ -259,8 +262,8 @@ class _FixedSubmitPageState extends State<FixedSubmitPage> {
}, },
).expand(), ).expand(),
MaterialButton( MaterialButton(
disabledColor: kDarkSubColor, disabledColor: Colors.white.withOpacity(0.5),
disabledTextColor: ktextSubColor, disabledTextColor: ktextSubColor.withOpacity(0.8),
textColor: ktextPrimary, textColor: ktextPrimary,
onPressed: _isEdit onPressed: _isEdit
? _selected.isEmpty ? _selected.isEmpty

@ -17,6 +17,8 @@ class FixedCheckBox extends StatefulWidget {
class _FixedCheckBoxState extends State<FixedCheckBox> { class _FixedCheckBoxState extends State<FixedCheckBox> {
bool _isSelected = false; bool _isSelected = false;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GestureDetector( return GestureDetector(
@ -28,6 +30,7 @@ class _FixedCheckBoxState extends State<FixedCheckBox> {
}, },
child: AnimatedContainer( child: AnimatedContainer(
duration: Duration(milliseconds: 300), duration: Duration(milliseconds: 300),
curve: Curves.easeInOutCubic,
alignment: Alignment.center, alignment: Alignment.center,
width: 40.w, width: 40.w,
height: 40.w, height: 40.w,
@ -39,11 +42,12 @@ class _FixedCheckBoxState extends State<FixedCheckBox> {
), ),
child: AnimatedContainer( child: AnimatedContainer(
duration: Duration(milliseconds: 300), duration: Duration(milliseconds: 300),
curve: Curves.easeInOutCubic,
width: 24.w, width: 24.w,
height: 24.w, height: 24.w,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(24.w), borderRadius: BorderRadius.circular(24.w),
color: _isSelected ? kPrimaryColor : Colors.transparent, color: kPrimaryColor.withOpacity(_isSelected?1:0)
), ),
), ),
), ),

Loading…
Cancel
Save