mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
push basic layouts and shared widgets
This commit is contained in:
@ -1,9 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:syncrow_web/pages/common/buttons/search_reset_buttons.dart';
|
||||
import 'package:syncrow_web/pages/common/custom_table.dart';
|
||||
import 'package:syncrow_web/pages/common/custom_web_textfield.dart';
|
||||
import 'package:syncrow_web/pages/common/default_button.dart';
|
||||
import 'package:syncrow_web/pages/common/text_field/custom_web_textfield.dart';
|
||||
import 'package:syncrow_web/pages/common/buttons/default_button.dart';
|
||||
import 'package:syncrow_web/pages/visitor_password/bloc/visitor_password_bloc.dart';
|
||||
import 'package:syncrow_web/pages/visitor_password/bloc/visitor_password_event.dart';
|
||||
import 'package:syncrow_web/pages/visitor_password/bloc/visitor_password_state.dart';
|
||||
@ -12,7 +13,6 @@ import 'package:syncrow_web/utils/constants/assets.dart';
|
||||
import 'package:syncrow_web/utils/constants/const.dart';
|
||||
import 'package:syncrow_web/utils/style.dart';
|
||||
|
||||
|
||||
class AddDeviceDialog extends StatelessWidget {
|
||||
const AddDeviceDialog({super.key});
|
||||
@override
|
||||
@ -27,8 +27,8 @@ class AddDeviceDialog extends StatelessWidget {
|
||||
backgroundColor: Colors.white,
|
||||
title: const Text('Add Accessible Device'),
|
||||
content: Container(
|
||||
height: MediaQuery.of(context).size.height/1.7,
|
||||
width: MediaQuery.of(context).size.width/2,
|
||||
height: MediaQuery.of(context).size.height / 1.7,
|
||||
width: MediaQuery.of(context).size.width / 2,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: Column(
|
||||
@ -36,11 +36,10 @@ class AddDeviceDialog extends StatelessWidget {
|
||||
Container(
|
||||
width: size.width,
|
||||
padding: EdgeInsets.all(15),
|
||||
decoration:containerDecoration.copyWith(
|
||||
decoration: containerDecoration.copyWith(
|
||||
color: ColorsManager.worningColor,
|
||||
border: Border.all(color: Color(0xffFFD22F)),
|
||||
boxShadow: []
|
||||
),
|
||||
boxShadow: []),
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
@ -50,12 +49,15 @@ class AddDeviceDialog extends StatelessWidget {
|
||||
width: 15,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10,),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text('Only online accessible devices can be added'),
|
||||
],
|
||||
)
|
||||
)),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
SizedBox(height: 20,),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
@ -89,93 +91,55 @@ class AddDeviceDialog extends StatelessWidget {
|
||||
description: '',
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(width: 10),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(height: 25),
|
||||
Center(
|
||||
child: Container(
|
||||
height: 43,
|
||||
width: 100,
|
||||
decoration: containerDecoration,
|
||||
child: Center(
|
||||
child: DefaultButton(
|
||||
onPressed: () {
|
||||
visitorBloc.filterDevices(); // Call filter function
|
||||
},
|
||||
borderRadius: 9,
|
||||
child: const Text('Search'),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
SearchResetButtons(
|
||||
onSearch: () {
|
||||
visitorBloc.filterDevices();
|
||||
},
|
||||
onReset: () {
|
||||
visitorBloc.deviceNameController.clear();
|
||||
visitorBloc.deviceIdController.clear();
|
||||
visitorBloc.unitNameController.clear();
|
||||
visitorBloc.add(FetchDevice());
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(height: 25),
|
||||
|
||||
Center(
|
||||
child: Container(
|
||||
height: 43,
|
||||
width: 100,
|
||||
decoration: containerDecoration,
|
||||
child: Center(
|
||||
child: DefaultButton(
|
||||
backgroundColor: ColorsManager.whiteColors,
|
||||
borderRadius: 9,
|
||||
child: Text(
|
||||
'Reset',
|
||||
style: Theme.of(context).textTheme.bodySmall!.copyWith(color: Colors.black),
|
||||
),
|
||||
onPressed: () {
|
||||
visitorBloc.deviceNameController.clear();
|
||||
visitorBloc.deviceIdController.clear();
|
||||
visitorBloc.unitNameController.clear();
|
||||
visitorBloc.add(FetchDevice()); // Reset to original list
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Expanded(
|
||||
child: state is TableLoaded
|
||||
? DynamicTable(
|
||||
cellDecoration: containerDecoration,
|
||||
selectAll: (p0) {
|
||||
visitorBloc.selectedDeviceIds.clear();
|
||||
for (var item in state.data) {
|
||||
visitorBloc.add(SelectDeviceEvent(item.uuid));
|
||||
}
|
||||
},
|
||||
onRowCheckboxChanged: (index, isSelected) {
|
||||
final deviceId = state.data[index].uuid;
|
||||
visitorBloc.add(SelectDeviceEvent(deviceId));
|
||||
},
|
||||
withCheckBox: true,
|
||||
size: size*0.5,
|
||||
headers: const [ 'Device Name', 'Device ID', 'Access Type', 'Unit Name', 'Status'],
|
||||
data: state.data.map((item) {
|
||||
return [
|
||||
item.name.toString(),
|
||||
item.uuid.toString(),
|
||||
item.productType.toString(),
|
||||
'',
|
||||
item.online.value.toString(),
|
||||
];
|
||||
}).toList(),
|
||||
)
|
||||
child: state is TableLoaded
|
||||
? DynamicTable(
|
||||
cellDecoration: containerDecoration,
|
||||
selectAll: (p0) {
|
||||
visitorBloc.selectedDeviceIds.clear();
|
||||
for (var item in state.data) {
|
||||
visitorBloc
|
||||
.add(SelectDeviceEvent(item.uuid));
|
||||
}
|
||||
},
|
||||
onRowCheckboxChanged: (index, isSelected) {
|
||||
final deviceId = state.data[index].uuid;
|
||||
visitorBloc.add(SelectDeviceEvent(deviceId));
|
||||
},
|
||||
withCheckBox: true,
|
||||
size: size * 0.5,
|
||||
headers: const [
|
||||
'Device Name',
|
||||
'Device ID',
|
||||
'Access Type',
|
||||
'Unit Name',
|
||||
'Status'
|
||||
],
|
||||
data: state.data.map((item) {
|
||||
return [
|
||||
item.name.toString(),
|
||||
item.uuid.toString(),
|
||||
item.productType.toString(),
|
||||
'',
|
||||
item.online.value.toString(),
|
||||
];
|
||||
}).toList(),
|
||||
)
|
||||
: const Center(child: CircularProgressIndicator()))
|
||||
],
|
||||
),
|
||||
@ -201,7 +165,7 @@ class AddDeviceDialog extends StatelessWidget {
|
||||
Container(
|
||||
decoration: containerDecoration,
|
||||
width: size.width * 0.2,
|
||||
child: DefaultButton(
|
||||
child: DefaultButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop(); // Close the dialog
|
||||
},
|
||||
|
@ -1,9 +1,9 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_web/pages/common/custom_web_textfield.dart';
|
||||
import 'package:syncrow_web/pages/common/text_field/custom_web_textfield.dart';
|
||||
import 'package:syncrow_web/pages/common/date_time_widget.dart';
|
||||
import 'package:syncrow_web/pages/common/default_button.dart';
|
||||
import 'package:syncrow_web/pages/common/buttons/default_button.dart';
|
||||
import 'package:syncrow_web/pages/common/info_dialog.dart';
|
||||
import 'package:syncrow_web/pages/visitor_password/bloc/visitor_password_bloc.dart';
|
||||
import 'package:syncrow_web/pages/visitor_password/bloc/visitor_password_event.dart';
|
||||
|
Reference in New Issue
Block a user