mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-27 14:24:54 +00:00
garage size
This commit is contained in:
@ -24,15 +24,17 @@ class GarageDoorScreen extends StatelessWidget {
|
|||||||
return DefaultScaffold(
|
return DefaultScaffold(
|
||||||
title: 'Garage Door Opener',
|
title: 'Garage Door Opener',
|
||||||
child: BlocProvider(
|
child: BlocProvider(
|
||||||
create: (context) =>
|
create: (context) => GarageDoorBloc(GDId: device?.uuid ?? '')
|
||||||
GarageDoorBloc(GDId: device?.uuid ?? '')..add(const GarageDoorInitial()),
|
..add(const GarageDoorInitial()),
|
||||||
child: BlocBuilder<GarageDoorBloc, GarageDoorSensorState>(
|
child: BlocBuilder<GarageDoorBloc, GarageDoorSensorState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
final garageBloc = BlocProvider.of<GarageDoorBloc>(context);
|
final garageBloc = BlocProvider.of<GarageDoorBloc>(context);
|
||||||
return state is GarageDoorLoadingState
|
return state is GarageDoorLoadingState
|
||||||
? const Center(
|
? const Center(
|
||||||
child:
|
child: DefaultContainer(
|
||||||
DefaultContainer(width: 50, height: 50, child: CircularProgressIndicator()),
|
width: 50,
|
||||||
|
height: 50,
|
||||||
|
child: CircularProgressIndicator()),
|
||||||
)
|
)
|
||||||
: RefreshIndicator(
|
: RefreshIndicator(
|
||||||
onRefresh: () async {
|
onRefresh: () async {
|
||||||
@ -45,32 +47,38 @@ class GarageDoorScreen extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 4,
|
flex: 5,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
overlayColor: WidgetStateProperty.all(Colors.transparent),
|
overlayColor: WidgetStateProperty.all(
|
||||||
|
Colors.transparent),
|
||||||
onTap: () {},
|
onTap: () {},
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(890),
|
borderRadius:
|
||||||
|
BorderRadius.circular(890),
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.white.withOpacity(0.1),
|
color: Colors.white
|
||||||
|
.withOpacity(0.1),
|
||||||
blurRadius: 24,
|
blurRadius: 24,
|
||||||
offset: const Offset(-5, -5),
|
offset: const Offset(-5, -5),
|
||||||
blurStyle: BlurStyle.outer,
|
blurStyle: BlurStyle.outer,
|
||||||
),
|
),
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.black.withOpacity(0.11),
|
color: Colors.black
|
||||||
|
.withOpacity(0.11),
|
||||||
blurRadius: 25,
|
blurRadius: 25,
|
||||||
offset: const Offset(5, 5),
|
offset: const Offset(5, 5),
|
||||||
blurStyle: BlurStyle.outer,
|
blurStyle: BlurStyle.outer,
|
||||||
),
|
),
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.black.withOpacity(0.13),
|
color: Colors.black
|
||||||
|
.withOpacity(0.13),
|
||||||
blurRadius: 30,
|
blurRadius: 30,
|
||||||
offset: const Offset(5, 5),
|
offset: const Offset(5, 5),
|
||||||
blurStyle: BlurStyle.inner,
|
blurStyle: BlurStyle.inner,
|
||||||
@ -79,177 +87,222 @@ class GarageDoorScreen extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
garageBloc.add(
|
garageBloc.add(ToggleDoorEvent(
|
||||||
ToggleDoorEvent(toggle: garageBloc.toggleDoor));
|
toggle:
|
||||||
|
garageBloc.toggleDoor));
|
||||||
},
|
},
|
||||||
child: GradientWidget(
|
child: GradientWidget(
|
||||||
doorStatus: garageBloc.toggleDoor,
|
doorStatus: garageBloc.toggleDoor,
|
||||||
seconds: garageBloc.secondSelected,
|
seconds:
|
||||||
|
garageBloc.secondSelected,
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Flexible(
|
Expanded(
|
||||||
child: Row(
|
flex: 3,
|
||||||
children: [
|
child: Column(
|
||||||
Expanded(
|
children: [
|
||||||
child: DefaultContainer(
|
Flexible(
|
||||||
onTap: () {
|
child: Row(
|
||||||
Navigator.of(context).push(
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => TimerScheduleScreen(
|
|
||||||
device: device!,
|
|
||||||
switchCode: 'switch_1',
|
|
||||||
deviceCode: 'countdown_1',
|
|
||||||
)),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
children: [
|
||||||
ConstrainedBox(
|
Expanded(
|
||||||
constraints:
|
child: DefaultContainer(
|
||||||
const BoxConstraints(maxHeight: 46, maxWidth: 50),
|
onTap: () {
|
||||||
child: SvgPicture.asset(Assets.garageSchedule),
|
Navigator.of(context).push(
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) =>
|
||||||
|
TimerScheduleScreen(
|
||||||
|
device: device!,
|
||||||
|
switchCode:
|
||||||
|
'switch_1',
|
||||||
|
deviceCode:
|
||||||
|
'countdown_1',
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
ConstrainedBox(
|
||||||
|
constraints:
|
||||||
|
const BoxConstraints(
|
||||||
|
maxHeight: 46,
|
||||||
|
maxWidth: 50),
|
||||||
|
child: SvgPicture.asset(
|
||||||
|
Assets
|
||||||
|
.garageSchedule),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
const Flexible(
|
||||||
|
child: FittedBox(
|
||||||
|
child: BodySmall(
|
||||||
|
text: 'Schedule',
|
||||||
|
textAlign:
|
||||||
|
TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 15,
|
width: 10,
|
||||||
),
|
),
|
||||||
const Flexible(
|
Expanded(
|
||||||
child: FittedBox(
|
child: DefaultContainer(
|
||||||
child: BodySmall(
|
onTap: () {
|
||||||
text: 'Schedule',
|
Navigator.of(context).push(
|
||||||
textAlign: TextAlign.center,
|
MaterialPageRoute(
|
||||||
|
builder: (context) =>
|
||||||
|
TimerPage(
|
||||||
|
device: device!,
|
||||||
|
switchCode:
|
||||||
|
'switch_1',
|
||||||
|
deviceCode:
|
||||||
|
'countdown_1',
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
ConstrainedBox(
|
||||||
|
constraints:
|
||||||
|
const BoxConstraints(
|
||||||
|
maxHeight: 46,
|
||||||
|
maxWidth: 50),
|
||||||
|
child: SvgPicture.asset(
|
||||||
|
Assets
|
||||||
|
.garageCountdown),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
const Flexible(
|
||||||
|
child: FittedBox(
|
||||||
|
child: BodySmall(
|
||||||
|
text: 'Countdown',
|
||||||
|
textAlign:
|
||||||
|
TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(
|
||||||
const SizedBox(
|
height: 10,
|
||||||
width: 10,
|
),
|
||||||
),
|
Flexible(
|
||||||
Expanded(
|
child: Row(
|
||||||
child: DefaultContainer(
|
|
||||||
onTap: () {
|
|
||||||
Navigator.of(context).push(
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => TimerPage(
|
|
||||||
device: device!,
|
|
||||||
switchCode: 'switch_1',
|
|
||||||
deviceCode: 'countdown_1',
|
|
||||||
)),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
children: [
|
||||||
ConstrainedBox(
|
Expanded(
|
||||||
constraints:
|
child: DefaultContainer(
|
||||||
const BoxConstraints(maxHeight: 46, maxWidth: 50),
|
onTap: () {
|
||||||
child: SvgPicture.asset(Assets.garageCountdown),
|
Navigator.of(context).push(
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) =>
|
||||||
|
GarageRecordsScreen(
|
||||||
|
GDId: device!
|
||||||
|
.uuid!)),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
ConstrainedBox(
|
||||||
|
constraints:
|
||||||
|
const BoxConstraints(
|
||||||
|
maxHeight: 46,
|
||||||
|
maxWidth: 50),
|
||||||
|
child: SvgPicture.asset(
|
||||||
|
Assets
|
||||||
|
.doorRecordsIcon),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
const Flexible(
|
||||||
|
child: FittedBox(
|
||||||
|
child: BodySmall(
|
||||||
|
text: 'Records',
|
||||||
|
textAlign:
|
||||||
|
TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 15,
|
width: 10,
|
||||||
),
|
),
|
||||||
const Flexible(
|
Expanded(
|
||||||
child: FittedBox(
|
child: DefaultContainer(
|
||||||
child: BodySmall(
|
onTap: () {
|
||||||
text: 'Countdown',
|
Navigator.of(context).push(
|
||||||
textAlign: TextAlign.center,
|
MaterialPageRoute(
|
||||||
|
builder: (context) =>
|
||||||
|
PreferencesPage(
|
||||||
|
GDId: device!
|
||||||
|
.uuid!)),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
ConstrainedBox(
|
||||||
|
constraints:
|
||||||
|
const BoxConstraints(
|
||||||
|
maxHeight: 46,
|
||||||
|
maxWidth: 50),
|
||||||
|
child: SvgPicture.asset(Assets
|
||||||
|
.garagePreferencesIcon),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
const Flexible(
|
||||||
|
child: FittedBox(
|
||||||
|
child: BodySmall(
|
||||||
|
text: 'Preferences',
|
||||||
|
textAlign:
|
||||||
|
TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
)
|
||||||
),
|
],
|
||||||
],
|
)),
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
Flexible(
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: DefaultContainer(
|
|
||||||
onTap: () {
|
|
||||||
Navigator.of(context).push(
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) =>
|
|
||||||
GarageRecordsScreen(GDId: device!.uuid!)),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
ConstrainedBox(
|
|
||||||
constraints:
|
|
||||||
const BoxConstraints(maxHeight: 46, maxWidth: 50),
|
|
||||||
child: SvgPicture.asset(Assets.doorRecordsIcon),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 15,
|
|
||||||
),
|
|
||||||
const Flexible(
|
|
||||||
child: FittedBox(
|
|
||||||
child: BodySmall(
|
|
||||||
text: 'Records',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
width: 10,
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: DefaultContainer(
|
|
||||||
onTap: () {
|
|
||||||
Navigator.of(context).push(
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) =>
|
|
||||||
PreferencesPage(GDId: device!.uuid!)),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
ConstrainedBox(
|
|
||||||
constraints:
|
|
||||||
const BoxConstraints(maxHeight: 46, maxWidth: 50),
|
|
||||||
child: SvgPicture.asset(Assets.garagePreferencesIcon),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 15,
|
|
||||||
),
|
|
||||||
const Flexible(
|
|
||||||
child: FittedBox(
|
|
||||||
child: BodySmall(
|
|
||||||
text: 'Preferences',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -272,7 +325,8 @@ class GradientWidget extends StatefulWidget {
|
|||||||
State<GradientWidget> createState() => _GradientWidgetState();
|
State<GradientWidget> createState() => _GradientWidgetState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _GradientWidgetState extends State<GradientWidget> with SingleTickerProviderStateMixin {
|
class _GradientWidgetState extends State<GradientWidget>
|
||||||
|
with SingleTickerProviderStateMixin {
|
||||||
late ScrollController _scrollController;
|
late ScrollController _scrollController;
|
||||||
late AnimationController _animationController;
|
late AnimationController _animationController;
|
||||||
late Animation<double> _itemExtentAnimation;
|
late Animation<double> _itemExtentAnimation;
|
||||||
@ -285,15 +339,16 @@ class _GradientWidgetState extends State<GradientWidget> with SingleTickerProvid
|
|||||||
vsync: this,
|
vsync: this,
|
||||||
duration: Duration(seconds: widget.seconds),
|
duration: Duration(seconds: widget.seconds),
|
||||||
);
|
);
|
||||||
_itemExtentAnimation =
|
_itemExtentAnimation = Tween<double>(
|
||||||
Tween<double>(begin: widget.doorStatus ? 0 : 15, end: widget.doorStatus ? 15 : 0).animate(
|
begin: widget.doorStatus ? 0 : 15, end: widget.doorStatus ? 15 : 0)
|
||||||
|
.animate(
|
||||||
CurvedAnimation(
|
CurvedAnimation(
|
||||||
parent: _animationController,
|
parent: _animationController,
|
||||||
curve: Curves.easeInOut,
|
curve: Curves.easeInOut,
|
||||||
),
|
),
|
||||||
)..addListener(() {
|
)..addListener(() {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
});
|
});
|
||||||
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
if (widget.doorStatus) {
|
if (widget.doorStatus) {
|
||||||
|
|||||||
Reference in New Issue
Block a user