mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
Refactor expansion icon handling in CustomExpansionTileSpaceTree for improved readability and maintainability.
This commit is contained in:
@ -49,21 +49,7 @@ class CustomExpansionTileSpaceTree extends StatelessWidget {
|
||||
}),
|
||||
checkColor: ColorsManager.whiteColors,
|
||||
),
|
||||
if (children != null && children!.isNotEmpty)
|
||||
InkWell(
|
||||
onTap: () {
|
||||
if (onExpansionChanged != null) {
|
||||
onExpansionChanged!();
|
||||
}
|
||||
},
|
||||
child: Icon(
|
||||
isExpanded
|
||||
? Icons.keyboard_arrow_down
|
||||
: Icons.keyboard_arrow_right,
|
||||
color: ColorsManager.lightGrayColor,
|
||||
size: 16.0,
|
||||
),
|
||||
),
|
||||
_buildExpansionIcon(),
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
@ -96,6 +82,20 @@ class CustomExpansionTileSpaceTree extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildExpansionIcon() {
|
||||
return Visibility(
|
||||
visible: children != null && children!.isNotEmpty,
|
||||
child: InkWell(
|
||||
onTap: onExpansionChanged,
|
||||
child: Icon(
|
||||
isExpanded ? Icons.keyboard_arrow_down : Icons.keyboard_arrow_right,
|
||||
color: ColorsManager.lightGrayColor,
|
||||
size: 16.0,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String _capitalizeFirstLetter(String text) {
|
||||
if (text.isEmpty) return text;
|
||||
return text[0].toUpperCase() + text.substring(1);
|
||||
|
Reference in New Issue
Block a user