pull to refresh

This commit is contained in:
mohammad
2024-07-03 16:48:46 +03:00
parent cef32e9bf3
commit 038ed680dd
6 changed files with 734 additions and 664 deletions

View File

@ -66,17 +66,22 @@ class ACsView extends StatelessWidget {
child: state is AcsLoadingState
? const Center(
child: DefaultContainer(
width: 50, height: 50, child: CircularProgressIndicator()),
)
: Container(
width: 50, height: 50, child: CircularProgressIndicator()),)
: RefreshIndicator(
onRefresh: () async {
BlocProvider.of<ACsBloc>(context).add(AcsInitial(allAcs: deviceModel != null ? false : true));
},
child:ListView(
children: [
Container(
padding: const EdgeInsets.only(top: 40),
alignment: AlignmentDirectional.center,
child:
deviceModel != null ? AcInterface(ac: deviceModel!) : const ACsList(),
child: deviceModel != null ? AcInterface(ac: deviceModel!) : const ACsList(),
),
],
),),
),
),
);
));
},
),
);

View File

@ -29,6 +29,7 @@ class CeilingSensorInterface extends StatelessWidget {
// .firstWhere((element) => element.code == "presence_state")
// .value
// .toString();
return BlocProvider(
create: (context) =>
CeilingSensorBloc(deviceId: ceilingSensor.uuid ?? '')..add(InitialEvent()),
@ -69,14 +70,23 @@ class CeilingSensorInterface extends StatelessWidget {
child: state is LoadingInitialState
? const Center(
child: RefreshProgressIndicator(),
)
: SafeArea(
) : SafeArea(
child:
RefreshIndicator(
onRefresh: () async {
BlocProvider.of<CeilingSensorBloc>(context).add(InitialEvent());
},
child:Container(
child: ListView(
shrinkWrap: true,
children: [
Container(
height: MediaQuery.of(context).size.height,
child: Column(
children: [
Expanded(
flex: 1,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// InkWell(
// onTap: () {
@ -116,6 +126,7 @@ class CeilingSensorInterface extends StatelessWidget {
// },
// child:
// ),
SvgPicture.asset(
ceilingSensorModel.presenceState.toLowerCase() == 'motion'
? Assets.assetsIconsPresenceSensorAssetsPresenceSensorMotion
@ -150,8 +161,8 @@ class CeilingSensorInterface extends StatelessWidget {
),
),
Expanded(
flex: 2,
child: ListView(
flex: 3,
child: Column(
children: [
DefaultContainer(
padding: const EdgeInsets.symmetric(
@ -316,6 +327,12 @@ class CeilingSensorInterface extends StatelessWidget {
),
],
),
),
],
),
) ,
)
)),
),
);

View File

@ -40,8 +40,7 @@ class GateWayView extends StatelessWidget {
extendBody: true,
appBar:DeviceAppbar(
deviceName: 'Gateway',
deviceUuid: gatewayObj.uuid!,
),
deviceUuid: gatewayObj.uuid!,),
body: Container(
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height,
@ -55,6 +54,15 @@ class GateWayView extends StatelessWidget {
opacity: 0.4,
),
),
child: RefreshIndicator(
onRefresh:()async {
BlocProvider.of<GatewayBloc>(context).add(GatewayInitial(gatewayId: gatewayObj.uuid ?? ''));
},
child: ListView(
children: [
Container(
height: MediaQuery.of(context).size.height,
child: SafeArea(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -129,7 +137,12 @@ class GateWayView extends StatelessWidget {
],
),
),
)));
),
],
),
),
)
));
}));
}
}

View File

@ -98,7 +98,14 @@ class DoorInterface extends StatelessWidget {
? const Center(
child: RefreshProgressIndicator(),
)
: Column(
:
RefreshIndicator(
onRefresh: () async {
BlocProvider.of<SmartDoorBloc>(context).add(InitialEvent());
},
child:
ListView(
children: [
DoorLockStatusBar(
smartDoorModel: smartDoorModel,
@ -120,7 +127,7 @@ class DoorInterface extends StatelessWidget {
),
),
),
);
));
}),
);
}

View File

@ -55,12 +55,21 @@ class ThreeGangScreen extends StatelessWidget {
threeGangList: groupThreeGangModel,
allSwitches: allSwitchesOn,
)
: Column(
: RefreshIndicator(
onRefresh:()async {
BlocProvider.of<ThreeGangBloc>(context).add(InitialEvent(groupScreen: device != null ? false : true));
},
child: ListView(
children: [
SizedBox(
height: MediaQuery.of(context).size.height,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const Expanded(child: SizedBox.shrink()),
Row(
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
@ -147,6 +156,7 @@ class ThreeGangScreen extends StatelessWidget {
),
],
),
),
Expanded(
child: Center(
child: Row(
@ -373,7 +383,12 @@ class ThreeGangScreen extends StatelessWidget {
),
),
),
Expanded(child: SizedBox())
],
),
),
],
),
);
},
),

View File

@ -79,7 +79,17 @@ class WallMountedInterface extends StatelessWidget {
child: RefreshProgressIndicator(),
)
: SafeArea(
child: RefreshIndicator(
onRefresh: () async {
BlocProvider.of<WallSensorBloc>(context).add(InitialEvent());
},
child:
ListView(
children: [
Container(
height: MediaQuery.of(context).size.height,
child: Column(
children: [
PresenceIndicator(
state: wallSensorModel.presenceState,
@ -91,9 +101,12 @@ class WallMountedInterface extends StatelessWidget {
],
),
),
],
),
),
);
),
),
));
}),
);
}