chore(ui): Update notificationCard and warningCard in HomeScreen
This commit is contained in:
@@ -82,60 +82,57 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
stream: homeBloc.streamOwnerDevicesStatus,
|
stream: homeBloc.streamOwnerDevicesStatus,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
if (snapshot.data?['state'] != null || snapshot.data?['battery'] != null) {
|
if (snapshot.data?['state'] != null || snapshot.data?['battery'] != null) {
|
||||||
return Row(
|
return ConstrainedBox(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
constraints: BoxConstraints(minWidth: MediaQuery.of(context).size.width),
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
child: Row(
|
||||||
children: [
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
if (snapshot.data?['state'] != null)
|
children: [
|
||||||
...snapshot.data!['state']!
|
if (snapshot.data?['state'] != null)
|
||||||
.map(
|
...snapshot.data!['state']!
|
||||||
(item) => FutureBuilder<Widget>(
|
.map(
|
||||||
|
(item) => SizedBox(
|
||||||
|
width: context.dynamicWidth(0.95),
|
||||||
|
child: FutureBuilder<Widget>(
|
||||||
future: warningCard(context, apiServices, item),
|
future: warningCard(context, apiServices, item),
|
||||||
builder: (context, warningCardSnapshot) {
|
builder: (context, warningCardSnapshot) {
|
||||||
if (warningCardSnapshot.hasData) {
|
if (warningCardSnapshot.hasData) {
|
||||||
return ConstrainedBox(
|
return warningCardSnapshot.data!;
|
||||||
constraints: const BoxConstraints(
|
|
||||||
maxWidth: 400,
|
|
||||||
maxHeight: 260,
|
|
||||||
),
|
|
||||||
child: warningCardSnapshot.data!,
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
.toList(),
|
)
|
||||||
if (snapshot.data?['battery'] != null)
|
.toList(),
|
||||||
...snapshot.data!['battery']!
|
if (snapshot.data?['battery'] != null)
|
||||||
.map(
|
...snapshot.data!['battery']!
|
||||||
(batteryItem) => FutureBuilder<Widget>(
|
.map(
|
||||||
|
(batteryItem) => SizedBox(
|
||||||
|
width: context.dynamicWidth(0.95),
|
||||||
|
child: FutureBuilder<Widget>(
|
||||||
future: notificationCard(
|
future: notificationCard(
|
||||||
context, "lowBattery", appLocalization(context).low_battery_message, batteryItem),
|
context, "lowBattery", appLocalization(context).low_battery_message, batteryItem),
|
||||||
builder: (context, warningCardSnapshot) {
|
builder: (context, warningCardSnapshot) {
|
||||||
if (warningCardSnapshot.hasData) {
|
if (warningCardSnapshot.hasData) {
|
||||||
return ConstrainedBox(
|
return warningCardSnapshot.data!;
|
||||||
constraints: const BoxConstraints(
|
|
||||||
maxWidth: 400,
|
|
||||||
maxHeight: 260,
|
|
||||||
),
|
|
||||||
child: warningCardSnapshot.data!,
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
.toList(),
|
)
|
||||||
],
|
.toList(),
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: context.paddingMedium,
|
padding: context.paddingMedium,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Row(
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
const Icon(
|
const Icon(
|
||||||
Icons.check_circle_outline_rounded,
|
Icons.check_circle_outline_rounded,
|
||||||
@@ -159,6 +156,11 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
StreamBuilder<Map<String, List<DeviceWithAlias>>>(
|
StreamBuilder<Map<String, List<DeviceWithAlias>>>(
|
||||||
stream: homeBloc.streamAllDevicesAliasMap,
|
stream: homeBloc.streamAllDevicesAliasMap,
|
||||||
builder: (context, allDevicesAliasMapSnapshot) {
|
builder: (context, allDevicesAliasMapSnapshot) {
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ class OverviewCard extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Card(
|
return Card(
|
||||||
margin: context.paddingLow,
|
|
||||||
elevation: 8,
|
elevation: 8,
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)),
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
|
|||||||
Reference in New Issue
Block a user