parent
1113679ad7
commit
488c6a2337
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.8 KiB |
@ -0,0 +1,44 @@
|
||||
import 'package:aku_community_manager/mock_models/decoration/decoration_model.dart';
|
||||
import 'package:aku_community_manager/style/app_style.dart';
|
||||
import 'package:aku_community_manager/tools/widget_tool.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:aku_community_manager/tools/screen_tool.dart';
|
||||
|
||||
class DecorationCheckCardWidget extends StatelessWidget {
|
||||
final CHECK_TYPE type;
|
||||
const DecorationCheckCardWidget({Key key, @required this.type})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: 160.w,
|
||||
width: 124.w,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
checkAssetMap[type],
|
||||
height: 56.w,
|
||||
width: 56.w,
|
||||
),
|
||||
AkuBox.h(4),
|
||||
Text(
|
||||
checkTypeMap[type],
|
||||
style: TextStyle(
|
||||
color: AppStyle.primaryTextColor,
|
||||
fontSize: 24.sp,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Color(0xFFE8E8E8),
|
||||
width: 3.w,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(8.w),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
import 'package:aku_community_manager/mock_models/decoration/decoration_model.dart';
|
||||
import 'package:aku_community_manager/tools/widget_tool.dart';
|
||||
import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_check_card_widget.dart';
|
||||
import 'package:aku_community_manager/tools/screen_tool.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DecorationCheckRow extends StatelessWidget {
|
||||
final List<CHECK_TYPE> details;
|
||||
const DecorationCheckRow({Key key, @required this.details}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
height: 160.w,
|
||||
child: ListView.separated(
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemBuilder: (context, index) {
|
||||
return DecorationCheckCardWidget(
|
||||
type: details[index],
|
||||
);
|
||||
},
|
||||
itemCount: details.length,
|
||||
separatorBuilder: (context, index) {
|
||||
return AkuBox.w(16);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,109 @@
|
||||
import 'package:aku_community_manager/style/app_style.dart';
|
||||
import 'package:aku_community_manager/tools/widget_tool.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DecorationCheckBox extends StatefulWidget {
|
||||
final bool initValue;
|
||||
final Function(bool state) onChange;
|
||||
DecorationCheckBox({Key key, this.initValue = true, this.onChange})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_DecorationCheckBoxState createState() => _DecorationCheckBoxState();
|
||||
}
|
||||
|
||||
class _DecorationCheckBoxState extends State<DecorationCheckBox> {
|
||||
bool _nowValue;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_nowValue = widget.initValue;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
_buildBox(
|
||||
rawChecked: true,
|
||||
color: AppStyle.successColor,
|
||||
subColor: AppStyle.subSuccessColor,
|
||||
title: '正常',
|
||||
icon: Icons.check,
|
||||
),
|
||||
AkuBox.w(56),
|
||||
_buildBox(
|
||||
rawChecked: false,
|
||||
color: AppStyle.failColor,
|
||||
subColor: AppStyle.subFailColor,
|
||||
title: '异常',
|
||||
icon: Icons.check,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
_buildBox(
|
||||
{bool rawChecked,
|
||||
Color color,
|
||||
Color subColor,
|
||||
String title,
|
||||
IconData icon}) {
|
||||
final checked = _nowValue == rawChecked;
|
||||
return GestureDetector(
|
||||
onTap: widget.onChange == null
|
||||
? null
|
||||
: () {
|
||||
setState(() {
|
||||
_nowValue = rawChecked;
|
||||
});
|
||||
widget.onChange(_nowValue);
|
||||
},
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
AnimatedContainer(
|
||||
height: 40.w,
|
||||
width: 40.w,
|
||||
curve: Curves.easeInOutCubic,
|
||||
child: _buildIcon(icon, color, checked),
|
||||
duration: Duration(milliseconds: 300),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(20.w),
|
||||
border: Border.all(
|
||||
color: checked ? color : Color(0xFFE8E8E8),
|
||||
),
|
||||
color: checked ? subColor : subColor.withOpacity(0),
|
||||
),
|
||||
),
|
||||
AkuBox.w(16),
|
||||
AkuBox.h(96),
|
||||
_buildText(title, color, checked),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_buildText(String title, Color color, bool checked) {
|
||||
return Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
color: checked ? color : AppStyle.minorTextColor,
|
||||
fontSize: 24.sp,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_buildIcon(IconData icon, Color color, bool checked) {
|
||||
return Icon(
|
||||
icon,
|
||||
color: checked ? color : Color(0xFFE8E8E8),
|
||||
size: 32.w,
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue