mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-08-26 07:49:40 +00:00
water heater and timer and schedule ui and api ,
Circulate ui and Inching ui
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/water_heater_bloc/water_heater_event.dart';
|
import 'package:syncrow_app/features/devices/bloc/water_heater_bloc/water_heater_event.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/water_heater_bloc/water_heater_state.dart';
|
import 'package:syncrow_app/features/devices/bloc/water_heater_bloc/water_heater_state.dart';
|
||||||
@ -308,4 +309,26 @@ class WaterHeaterBloc extends Bloc<WaterHeaterEvent, WaterHeaterState> {
|
|||||||
emit(ChangeSlidingSegmentState(value: selectedTabIndex));
|
emit(ChangeSlidingSegmentState(value: selectedTabIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// showTime(){
|
||||||
|
// final TimeOfDay? timePicked = await showTimePicker(
|
||||||
|
// context: event.context,
|
||||||
|
// initialTime: TimeOfDay.now(),
|
||||||
|
// builder: (context, child) {
|
||||||
|
// return Theme(
|
||||||
|
// data: ThemeData.light().copyWith(
|
||||||
|
// colorScheme: const ColorScheme.light(
|
||||||
|
// primary: ColorsManager.primaryColor,
|
||||||
|
// onSurface: Colors.black,
|
||||||
|
// ),
|
||||||
|
// buttonTheme: const ButtonThemeData(
|
||||||
|
// colorScheme: ColorScheme.light(
|
||||||
|
// primary: Colors.green,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// child: child!,
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
||||||
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
||||||
import '../../../../../utils/resource_manager/color_manager.dart';
|
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||||
|
|
||||||
|
|
||||||
class InchingWidget extends StatefulWidget {
|
class InchingWidget extends StatefulWidget {
|
||||||
@ -48,22 +46,98 @@ class _InchingWidgetState extends State<InchingWidget> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 10,),
|
const SizedBox(height: 10,),
|
||||||
Text('Once enabled this feature, each time the device is turned on, it will automatically turn of after a period time as pre-set.'),
|
const Text('Once enabled this feature, each time the device is turned on, it will automatically turn of after a period time as pre-set.'),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
const Padding(
|
||||||
height: 110,
|
padding: EdgeInsets.only(right: 30,left: 30),
|
||||||
child: CupertinoDatePicker(
|
child: Divider(),
|
||||||
mode: CupertinoDatePickerMode.time,
|
),
|
||||||
initialDateTime: DateTime.now(),
|
Container(
|
||||||
onDateTimeChanged: (selectedTime) {
|
child: MinuteSecondPicker()),
|
||||||
}, ),
|
const Padding(
|
||||||
|
padding: EdgeInsets.only(right: 30,left: 30),
|
||||||
|
child: Divider(),
|
||||||
),
|
),
|
||||||
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
class MinuteSecondPicker extends StatefulWidget {
|
||||||
|
const MinuteSecondPicker({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_MinuteSecondPickerState createState() => _MinuteSecondPickerState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MinuteSecondPickerState extends State<MinuteSecondPicker> {
|
||||||
|
int selectedMinute = 0;
|
||||||
|
int selectedSecond = 0;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Center(
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
// Minutes picker
|
||||||
|
Container(
|
||||||
|
height: 80,
|
||||||
|
width: 100,
|
||||||
|
child: CupertinoPicker(
|
||||||
|
itemExtent: 40.0,
|
||||||
|
scrollController: FixedExtentScrollController(initialItem: selectedMinute),
|
||||||
|
onSelectedItemChanged: (int index) {
|
||||||
|
setState(() {
|
||||||
|
selectedMinute = index;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
children: List<Widget>.generate(61, (int index) {
|
||||||
|
return Center(
|
||||||
|
child: BodyLarge(
|
||||||
|
text: index.toString().padLeft(2, '0'),
|
||||||
|
style: const TextStyle(
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
fontSize: 30,color: Colors.blue),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Text('M'),
|
||||||
|
SizedBox(width: 20),
|
||||||
|
// Seconds picker
|
||||||
|
Container(
|
||||||
|
height: 80,
|
||||||
|
width: 100,
|
||||||
|
child: CupertinoPicker(
|
||||||
|
itemExtent: 40.0,
|
||||||
|
scrollController: FixedExtentScrollController(initialItem: selectedSecond),
|
||||||
|
onSelectedItemChanged: (int index) {
|
||||||
|
setState(() {
|
||||||
|
selectedSecond = index;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
children: List<Widget>.generate(60, (int index) {
|
||||||
|
return Center(
|
||||||
|
child: BodyLarge(
|
||||||
|
text: index.toString().padLeft(2, '0'),
|
||||||
|
style: const TextStyle(
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
fontSize: 30,color: Colors.blue),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Text('S'),
|
||||||
|
|
||||||
|
],
|
||||||
|
),
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -126,30 +126,19 @@ class CirculateWidget extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
const DefaultContainer(child:
|
DefaultContainer(child:
|
||||||
Column(
|
Column(
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
InkWell(
|
||||||
padding: EdgeInsets.all(8.0),
|
onTap: () {
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
},
|
||||||
children: [
|
child: const Padding(
|
||||||
Text('Start Duration'),
|
padding: EdgeInsets.all(8.0),
|
||||||
Row(
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text('0h 0m'),
|
Text('Start Duration'),
|
||||||
Icon(Icons.arrow_forward_ios_sharp,color:ColorsManager.graysColor,)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],),
|
|
||||||
),
|
|
||||||
Divider(color: ColorsManager.graysColor,),
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.all(8.0),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Text('End Duration'),
|
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Text('0h 0m'),
|
Text('0h 0m'),
|
||||||
@ -157,6 +146,27 @@ class CirculateWidget extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
],),
|
],),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Divider(color: ColorsManager.graysColor,),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
|
||||||
|
},
|
||||||
|
child: const Padding(
|
||||||
|
padding: EdgeInsets.all(8.0),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text('End Duration'),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text('0h 0m'),
|
||||||
|
Icon(Icons.arrow_forward_ios_sharp,color:ColorsManager.graysColor,)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
@ -165,4 +175,5 @@ class CirculateWidget extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user