ASCardExpandable 自定义title

null_safety
小赖 4 years ago
parent 5a79d9d8de
commit e20b6e250a

@ -10,7 +10,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
///ASCardExpandable.custom ///ASCardExpandable.custom
///extrachildren ///extrachildren
class ASCardExpandable extends StatefulWidget { class ASCardExpandable extends StatefulWidget {
final String title; final dynamic title;
final List<Widget> mid; final List<Widget> mid;
final List<Widget> children; final List<Widget> children;
final List<Widget> extra; final List<Widget> extra;
@ -61,6 +61,22 @@ class ASCardExpandable extends StatefulWidget {
class _ASCardExpandableState extends State<ASCardExpandable> { class _ASCardExpandableState extends State<ASCardExpandable> {
ExpandableController _expandableController = ExpandableController(); ExpandableController _expandableController = ExpandableController();
Widget get _title {
if (widget.title is String)
return widget.title.text.black.bold.size(16.sp).make();
if (widget.title is Widget)
return DefaultTextStyle(
child: widget.title,
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 16.sp,
),
);
else
return SizedBox();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ASOptionTile( return ASOptionTile(
@ -71,7 +87,7 @@ class _ASCardExpandableState extends State<ASCardExpandable> {
), ),
controller: _expandableController, controller: _expandableController,
header: ASListTileX( header: ASListTileX(
title: widget.title.text.black.bold.size(16.sp).make(), title: _title,
prefixes: widget.mid, prefixes: widget.mid,
suffix: ASMaterialButton( suffix: ASMaterialButton(
child: AnimatedSwitcher( child: AnimatedSwitcher(

Loading…
Cancel
Save