mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-23 10:37:56 +00:00
one touch
This commit is contained in:
@@ -9,6 +9,7 @@ import 'package:syncrow_app/features/devices/model/group_one_touch_model.dart';
|
||||
import 'package:syncrow_app/features/devices/model/one_touch_model.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/circular_button.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/device_appbar.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/one_touch/one_touch_setting.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/one_touch/one_touch_timer_screen.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/three_gang/gang_switch.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
||||
@@ -183,7 +184,7 @@ class OneTouchScreen extends StatelessWidget {
|
||||
),
|
||||
CircularButton(
|
||||
device: device,
|
||||
icons: Icons.access_time,
|
||||
icons: Icons.settings,
|
||||
label: 'Setting',
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
@@ -192,13 +193,7 @@ class OneTouchScreen extends StatelessWidget {
|
||||
pageBuilder: (context,
|
||||
animation1,
|
||||
animation2) =>
|
||||
TimerScheduleScreen(
|
||||
switchCode:
|
||||
'switch_1',
|
||||
device: device!,
|
||||
deviceCode:
|
||||
'countdown_1',
|
||||
)));
|
||||
OneTouchSetting()));
|
||||
},
|
||||
),
|
||||
],
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_app/features/devices/bloc/one_gang_bloc/one_gang_bloc.dart';
|
||||
import 'package:syncrow_app/features/devices/bloc/one_gang_bloc/one_gang_event.dart';
|
||||
import 'package:syncrow_app/features/devices/bloc/one_gang_bloc/one_gang_state.dart';
|
||||
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
||||
import 'package:syncrow_app/features/devices/model/group_one_gang_model.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/one_gang/one_gang_list.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
|
||||
|
||||
class OneTouchSetting extends StatelessWidget {
|
||||
const OneTouchSetting({super.key, this.device});
|
||||
|
||||
final DeviceModel? device;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<GroupOneGangModel> groupOneGangModel = [];
|
||||
|
||||
return DefaultScaffold(
|
||||
child: BlocProvider(
|
||||
create: (context) =>
|
||||
OneGangBloc(switchCode: '', oneGangId: device?.uuid ?? '')
|
||||
..add(InitialWizardEvent()),
|
||||
child: BlocBuilder<OneGangBloc, OneGangState>(
|
||||
builder: (context, state) {
|
||||
bool allSwitchesOn = false;
|
||||
|
||||
if (state is UpdateGroupState) {
|
||||
groupOneGangModel = state.oneGangList;
|
||||
allSwitchesOn = state.allSwitches;
|
||||
}
|
||||
return state is LoadingInitialState
|
||||
? const Center(
|
||||
child: DefaultContainer(
|
||||
width: 50,
|
||||
height: 50,
|
||||
child: CircularProgressIndicator()),
|
||||
)
|
||||
: Container();
|
||||
},
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user