From e20b6e250a5ab1601a741349555e594b3a5bc41e Mon Sep 17 00:00:00 2001 From: laiiihz Date: Thu, 25 Feb 2021 10:32:52 +0800 Subject: [PATCH] =?UTF-8?q?ASCardExpandable=20=E8=87=AA=E5=AE=9A=E4=B9=89t?= =?UTF-8?q?itle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/list_tile/as_card_expandable.dart | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/list_tile/as_card_expandable.dart b/lib/list_tile/as_card_expandable.dart index a8098db..ffea67a 100644 --- a/lib/list_tile/as_card_expandable.dart +++ b/lib/list_tile/as_card_expandable.dart @@ -10,7 +10,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; ///ASCardExpandable.custom 自定义显示列表, ///默认自动将extra连接在children后面 class ASCardExpandable extends StatefulWidget { - final String title; + final dynamic title; final List mid; final List children; final List extra; @@ -61,6 +61,22 @@ class ASCardExpandable extends StatefulWidget { class _ASCardExpandableState extends State { 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 Widget build(BuildContext context) { return ASOptionTile( @@ -71,7 +87,7 @@ class _ASCardExpandableState extends State { ), controller: _expandableController, header: ASListTileX( - title: widget.title.text.black.bold.size(16.sp).make(), + title: _title, prefixes: widget.mid, suffix: ASMaterialButton( child: AnimatedSwitcher(