mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-23 07:07:55 +00:00
Merge pull request #87 from SyncrowIOT/FE-Complete-the-Device-Name-as
Refactor device name display in RoomPageSwitch widget
This commit is contained in:
@@ -76,32 +76,45 @@ class RoomPageSwitch extends StatelessWidget {
|
|||||||
: const SizedBox(),
|
: const SizedBox(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Flexible(
|
LayoutBuilder(
|
||||||
child: FittedBox(
|
builder: (context, constraints) {
|
||||||
child: Column(
|
final text = device.name ?? "";
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
final textPainter = TextPainter(
|
||||||
children: [
|
text: TextSpan(
|
||||||
Text(
|
text: text,
|
||||||
device.name ?? "",
|
style: context.bodyLarge.copyWith(
|
||||||
overflow: TextOverflow.ellipsis,
|
fontWeight: FontWeight.bold,
|
||||||
maxLines: 2,
|
fontSize: 20,
|
||||||
style: context.bodyLarge.copyWith(
|
color: Colors.grey,
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
fontSize: 20,
|
|
||||||
color: Colors.grey,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Text(
|
),
|
||||||
device.subspace!.subspaceName ?? '',
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
textDirection: TextDirection.ltr,
|
||||||
style: context.bodySmall.copyWith(
|
);
|
||||||
fontWeight: FontWeight.w400,
|
|
||||||
fontSize: 10,
|
textPainter.layout(maxWidth: constraints.maxWidth);
|
||||||
color: Colors.grey,
|
|
||||||
),
|
final exceeded = textPainter.didExceedMaxLines;
|
||||||
),
|
|
||||||
],
|
return Text(
|
||||||
),
|
exceeded ? '${text.substring(0, 10)}...' : text,
|
||||||
|
style: context.bodyLarge.copyWith(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 20,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
maxLines: 1,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
device.subspace!.subspaceName ?? '',
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: context.bodySmall.copyWith(
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
fontSize: 10,
|
||||||
|
color: Colors.grey,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -119,7 +132,6 @@ Future<void> showDeviceInterface(
|
|||||||
required BuildContext context,
|
required BuildContext context,
|
||||||
required isAllDevices,
|
required isAllDevices,
|
||||||
List<DeviceModel>? allDevices}) async {
|
List<DeviceModel>? allDevices}) async {
|
||||||
print('object-----${device.uuid} ${device.name}');
|
|
||||||
|
|
||||||
final devicesCubit = context.read<DevicesCubit>();
|
final devicesCubit = context.read<DevicesCubit>();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user