@@ -129,13 +129,9 @@ class _TDCellState extends State<TDCell> {
129129 @override
130130 Widget build (BuildContext context) {
131131 final theme = TDTheme .of (context);
132- final style = widget.style ??
133- TDCellInherited .of (context)? .style ??
134- TDCellStyle .cellStyle (context);
132+ final style = widget.style ?? TDCellInherited .of (context)? .style ?? TDCellStyle .cellStyle (context);
135133 final crossAxisAlignment = _getAlign ();
136- final color = _status == 'default'
137- ? style.backgroundColor
138- : style.clickBackgroundColor;
134+ final color = _status == 'default' ? style.backgroundColor : style.clickBackgroundColor;
139135 final border = (widget.showBottomBorder ?? false )
140136 ? Border (
141137 bottom: BorderSide (
@@ -153,9 +149,7 @@ class _TDCellState extends State<TDCell> {
153149 }
154150 TDSwipeCellInherited .of (context)? .cellClick ();
155151 },
156- onLongPress: widget.onLongPress != null && ! disabled
157- ? () => widget.onLongPress !(widget)
158- : null ,
152+ onLongPress: widget.onLongPress != null && ! disabled ? () => widget.onLongPress !(widget) : null ,
159153 onTapDown: (_) => _setStatus ('active' , 0 ),
160154 onTapUp: (_) => _setStatus ('default' , 100 ),
161155 onTapCancel: () => _setStatus ('default' , 0 ),
@@ -165,25 +159,27 @@ class _TDCellState extends State<TDCell> {
165159 decoration: BoxDecoration (color: color, border: border),
166160 child: Row (
167161 crossAxisAlignment: crossAxisAlignment,
162+ mainAxisAlignment: MainAxisAlignment .spaceBetween,
168163 children: [
169164 ..._buildImage (),
170- Expanded (
171- child: Row (
172- crossAxisAlignment: CrossAxisAlignment .start,
173- children: [
174- if (widget.leftIcon != null ||
175- widget.leftIconWidget != null ) ...[
176- widget.leftIconWidget ??
177- Icon (widget.leftIcon,
178- size: 24 , color: style.leftIconColor),
179- SizedBox (width: theme.spacer12),
180- ],
181- Expanded (
182- child: Column (
183- crossAxisAlignment: CrossAxisAlignment .start,
184- // spacing: theme.spacer4,
185- children: [
186- Row (
165+ Row (
166+ mainAxisSize: MainAxisSize .min,
167+ crossAxisAlignment: CrossAxisAlignment .start,
168+ children: [
169+ if (widget.leftIcon != null ||
170+ widget.leftIconWidget != null ) ...[
171+ widget.leftIconWidget ??
172+ Icon (widget.leftIcon,
173+ size: 24 , color: style.leftIconColor),
174+ SizedBox (width: theme.spacer12),
175+ ],
176+ Column (
177+ crossAxisAlignment: CrossAxisAlignment .start,
178+ // spacing: theme.spacer4,
179+ children: [
180+ IntrinsicWidth (
181+ child: Container (
182+ child: Row (
187183 children: [
188184 if (widget.titleWidget != null )
189185 Flexible (child: widget.titleWidget! )
@@ -195,37 +191,44 @@ class _TDCellState extends State<TDCell> {
195191 TDText (' *' , style: style.requiredStyle),
196192 ],
197193 ),
198- if ((widget.titleWidget != null || widget.title != null ) &&
199- (widget.descriptionWidget != null || widget.description? .isNotEmpty == true ))
200- SizedBox (height: TDTheme .of (context).spacer4),
201- if (widget.descriptionWidget != null )
202- widget.descriptionWidget!
203- else if (widget.description? .isNotEmpty ?? false )
204- TDText (widget.description! ,
205- style: style.descriptionStyle),
206- ],
194+ ),
207195 ),
208- ),
209- ],
210- ),
211- ),
212- Wrap (
213- spacing: theme.spacer4,
214- // crossAxisAlignment: WrapCrossAlignment.center,
215- children: [
216- if (widget.noteWidget != null )
217- widget.noteWidget!
218- else if (widget.note? .isNotEmpty ?? false )
219- TDText (widget.note! , style: style.noteStyle),
220- if (widget.rightIconWidget != null )
221- widget.rightIconWidget!
222- else if (widget.rightIcon != null )
223- Icon (widget.rightIcon, size: 24 , color: style.rightIconColor),
224- if (widget.arrow ?? false )
225- Icon (TDIcons .chevron_right,
226- size: 24 , color: style.arrowColor),
196+ if ((widget.titleWidget != null || widget.title != null ) &&
197+ (widget.descriptionWidget != null || widget.description? .isNotEmpty == true ))
198+ SizedBox (height: TDTheme .of (context).spacer4),
199+ if (widget.descriptionWidget != null )
200+ widget.descriptionWidget!
201+ else if (widget.description? .isNotEmpty ?? false )
202+ TDText (widget.description! ,
203+ style: style.descriptionStyle),
204+ ],
205+ ),
227206 ],
228207 ),
208+ SizedBox (width: theme.spacer8,),
209+ Expanded (
210+ child: Container (
211+ alignment: Alignment .centerRight,
212+ child: Builder (builder: (context) {
213+ if (widget.noteWidget != null ) {
214+ return widget.noteWidget! ;
215+ } else if (widget.note? .isNotEmpty ?? false ) {
216+ return TDText (
217+ widget.note! ,
218+ style: style.noteStyle,
219+ overflow: TextOverflow .ellipsis,
220+ maxLines: 1 ,
221+ );
222+ }
223+ return Container ();
224+ }),
225+ ),
226+ ),
227+ if (widget.rightIconWidget != null )
228+ widget.rightIconWidget!
229+ else if (widget.rightIcon != null )
230+ Icon (widget.rightIcon, size: 24 , color: style.rightIconColor),
231+ if (widget.arrow ?? false ) Icon (TDIcons .chevron_right, size: 24 , color: style.arrowColor),
229232 ],
230233 ),
231234 ),
0 commit comments