mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-27 20:04:55 +00:00
pull to refresh
This commit is contained in:
@ -39,9 +39,8 @@ class GateWayView extends StatelessWidget {
|
||||
extendBodyBehindAppBar: true,
|
||||
extendBody: true,
|
||||
appBar:DeviceAppbar(
|
||||
deviceName: 'Gateway',
|
||||
deviceUuid: gatewayObj.uuid!,
|
||||
),
|
||||
deviceName: 'Gateway',
|
||||
deviceUuid: gatewayObj.uuid!,),
|
||||
body: Container(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
height: MediaQuery.sizeOf(context).height,
|
||||
@ -55,81 +54,95 @@ class GateWayView extends StatelessWidget {
|
||||
opacity: 0.4,
|
||||
),
|
||||
),
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
child: RefreshIndicator(
|
||||
onRefresh:()async {
|
||||
BlocProvider.of<GatewayBloc>(context).add(GatewayInitial(gatewayId: gatewayObj.uuid ?? ''));
|
||||
},
|
||||
child: ListView(
|
||||
|
||||
children: [
|
||||
Container(
|
||||
height: MediaQuery.sizeOf(context).height * 0.3,
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
alignment: AlignmentDirectional.center,
|
||||
child: Stack(children: [
|
||||
SvgPicture.asset(
|
||||
Assets.gatewayIcon,
|
||||
width: 125,
|
||||
height: 125,
|
||||
),
|
||||
Positioned(
|
||||
right: 30,
|
||||
top: 15,
|
||||
child: Container(
|
||||
width: 12,
|
||||
height: 12,
|
||||
decoration: const BoxDecoration(
|
||||
color: ColorsManager.lightGreen,
|
||||
shape: BoxShape.circle,
|
||||
height: MediaQuery.of(context).size.height,
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
height: MediaQuery.sizeOf(context).height * 0.3,
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
alignment: AlignmentDirectional.center,
|
||||
child: Stack(children: [
|
||||
SvgPicture.asset(
|
||||
Assets.gatewayIcon,
|
||||
width: 125,
|
||||
height: 125,
|
||||
),
|
||||
Positioned(
|
||||
right: 30,
|
||||
top: 15,
|
||||
child: Container(
|
||||
width: 12,
|
||||
height: 12,
|
||||
decoration: const BoxDecoration(
|
||||
color: ColorsManager.lightGreen,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
if (devicesList.isEmpty && state is UpdateGatewayState)
|
||||
Container(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
alignment: AlignmentDirectional.center,
|
||||
child: const BodyMedium(
|
||||
text: 'No devices found',
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
if (devicesList.isNotEmpty)
|
||||
const BodyMedium(
|
||||
text: 'Zigbee Devices',
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
state is GatewayLoadingState
|
||||
? Center(
|
||||
child: Container(
|
||||
margin: const EdgeInsets.only(top: 20),
|
||||
height: 50,
|
||||
width: 50,
|
||||
child: const RefreshProgressIndicator()),
|
||||
)
|
||||
: Expanded(
|
||||
child: GridView.builder(
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
crossAxisSpacing: 10,
|
||||
mainAxisSpacing: 10,
|
||||
childAspectRatio: 1.5,
|
||||
if (devicesList.isEmpty && state is UpdateGatewayState)
|
||||
Container(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
alignment: AlignmentDirectional.center,
|
||||
child: const BodyMedium(
|
||||
text: 'No devices found',
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
padding: const EdgeInsets.only(top: 10),
|
||||
shrinkWrap: true,
|
||||
itemCount: devicesList.length,
|
||||
itemBuilder: (context, index) {
|
||||
return RoomPageSwitch(device: devicesList[index]);
|
||||
},
|
||||
if (devicesList.isNotEmpty)
|
||||
const BodyMedium(
|
||||
text: 'Zigbee Devices',
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
)
|
||||
state is GatewayLoadingState
|
||||
? Center(
|
||||
child: Container(
|
||||
margin: const EdgeInsets.only(top: 20),
|
||||
height: 50,
|
||||
width: 50,
|
||||
child: const RefreshProgressIndicator()),
|
||||
)
|
||||
: Expanded(
|
||||
child: GridView.builder(
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
crossAxisSpacing: 10,
|
||||
mainAxisSpacing: 10,
|
||||
childAspectRatio: 1.5,
|
||||
),
|
||||
padding: const EdgeInsets.only(top: 10),
|
||||
shrinkWrap: true,
|
||||
itemCount: devicesList.length,
|
||||
itemBuilder: (context, index) {
|
||||
return RoomPageSwitch(device: devicesList[index]);
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)));
|
||||
)
|
||||
));
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user