添加 ASCardExpandable Widget

null_safety
小赖 4 years ago
parent 9f43265958
commit 5a79d9d8de

@ -1,6 +1,15 @@
# Generated by pub # Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile # See https://dart.dev/tools/pub/glossary#lockfile
packages: packages:
aku_ui:
dependency: transitive
description:
path: "."
ref: HEAD
resolved-ref: "89d1e665c372461ed87be46c9227377b305050b2"
url: "http://test.akuhotel.com:8099/aku_fe/aku_ui.git"
source: git
version: "0.0.1"
animator: animator:
dependency: transitive dependency: transitive
description: description:
@ -78,6 +87,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.0" version: "1.0.0"
expandable:
dependency: transitive
description:
name: expandable
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.1.4"
file: file:
dependency: transitive dependency: transitive
description: description:

@ -44,6 +44,7 @@ export 'list_tile/as_edit_tile.dart';
export 'list_tile/as_option_tile_item.dart'; export 'list_tile/as_option_tile_item.dart';
export 'list_tile/as_vertical_tile_item.dart'; export 'list_tile/as_vertical_tile_item.dart';
export 'list_tile/as_list_tile_x.dart'; export 'list_tile/as_list_tile_x.dart';
export 'list_tile/as_card_expandable.dart';
export 'refresh/as_refresh.dart'; export 'refresh/as_refresh.dart';

@ -0,0 +1,116 @@
import 'dart:math';
import 'package:aku_ui/aku_ui.dart';
import 'package:ansu_ui/ansu_ui.dart';
import 'package:expandable/expandable.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
///ASCardExpandable.custom
///extrachildren
class ASCardExpandable extends StatefulWidget {
final String title;
final List<Widget> mid;
final List<Widget> children;
final List<Widget> extra;
///childrenextraextrachildren
final bool custom;
ASCardExpandable({
Key key,
@required this.title,
this.children = const [],
this.extra = const [],
this.mid = const [],
}) : custom = false,
super(key: key);
///childrenextraextrachildren
ASCardExpandable.custom({
Key key,
@required this.title,
this.children = const [],
this.extra = const [],
this.mid = const [],
}) : custom = true,
super(key: key);
@override
_ASCardExpandableState createState() => _ASCardExpandableState();
static Widget tile(
{@required String title, @required Widget child, Widget suffix}) {
return Row(
textBaseline: TextBaseline.alphabetic,
children: [
10.wb,
34.hb,
SizedBox(
width: 85.w,
child: title.text.black.size(14.sp).make(),
),
DefaultTextStyle(style: TextStyle().black65.size(14), child: child)
.expanded,
suffix ?? SizedBox(),
10.wb,
],
);
}
}
class _ASCardExpandableState extends State<ASCardExpandable> {
ExpandableController _expandableController = ExpandableController();
@override
Widget build(BuildContext context) {
return ASOptionTile(
item: ExpandablePanel(
theme: ExpandableThemeData(
tapHeaderToExpand: false,
hasIcon: false,
),
controller: _expandableController,
header: ASListTileX(
title: widget.title.text.black.bold.size(16.sp).make(),
prefixes: widget.mid,
suffix: ASMaterialButton(
child: AnimatedSwitcher(
duration: Duration(milliseconds: 300),
child: Text(
_expandableController.expanded ? '收缩' : '展开',
key: ValueKey(_expandableController.expanded),
style: TextStyle().colorX(kPrimaryColor).size(16),
),
),
padding: 10.edge,
icon: AnimatedRotate(
child: Icon(
CupertinoIcons.chevron_down,
size: 16.w,
color: kPrimaryColor,
),
angle: _expandableController.expanded ? pi : 0,
),
onPressed: () {
_expandableController.toggle();
setState(() {});
},
),
),
collapsed: Column(
children: [
SizedBox(),
...widget.children,
].sepWidget(separate: ASDivider(indent: 10.w, endIndent: 10.w)),
),
expanded: Column(
children: [
SizedBox(),
...(widget.custom ? <Widget>[] : widget.children),
...widget.extra,
].sepWidget(separate: ASDivider(indent: 10.w, endIndent: 10.w)),
),
),
);
}
}

@ -1,6 +1,15 @@
# Generated by pub # Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile # See https://dart.dev/tools/pub/glossary#lockfile
packages: packages:
aku_ui:
dependency: "direct main"
description:
path: "."
ref: HEAD
resolved-ref: "89d1e665c372461ed87be46c9227377b305050b2"
url: "http://test.akuhotel.com:8099/aku_fe/aku_ui.git"
source: git
version: "0.0.1"
animator: animator:
dependency: transitive dependency: transitive
description: description:
@ -64,6 +73,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.15.0-nullsafety.3" version: "1.15.0-nullsafety.3"
expandable:
dependency: "direct main"
description:
name: expandable
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.1.4"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:

@ -16,6 +16,10 @@ dependencies:
image_picker: ^0.6.7+15 image_picker: ^0.6.7+15
bot_toast: ^3.0.5 bot_toast: ^3.0.5
velocity_x: velocity_x:
expandable: ^4.1.4
aku_ui:
git:
url: http://test.akuhotel.com:8099/aku_fe/aku_ui.git
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

Loading…
Cancel
Save