mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-24 18:37:56 +00:00
Update email and password validation logic in the LoginForm widget to only perform validation when the state is not AuthTokenError. This ensures that validation is skipped when there is an authentication token error.
96 lines
4.1 KiB
Dart
96 lines
4.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:flutter_svg/svg.dart';
|
|
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
|
import 'package:syncrow_app/utils/context_extension.dart';
|
|
import 'package:syncrow_app/utils/helpers/custom_page_route.dart';
|
|
|
|
import '../../bloc/devices_cubit.dart';
|
|
|
|
class WizartSwitches extends StatelessWidget {
|
|
const WizartSwitches({
|
|
super.key,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BlocBuilder<DevicesCubit, DevicesState>(
|
|
builder: (context, state) {
|
|
return state is! DevicesLoading
|
|
? DevicesCubit.allCategories != null
|
|
? GridView.builder(
|
|
gridDelegate:
|
|
const SliverGridDelegateWithFixedCrossAxisCount(
|
|
crossAxisCount: 2,
|
|
crossAxisSpacing: 10,
|
|
mainAxisSpacing: 10,
|
|
childAspectRatio: 1.5,
|
|
),
|
|
padding: const EdgeInsets.only(top: 10),
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
shrinkWrap: true,
|
|
itemCount: DevicesCubit.allCategories!.length,
|
|
itemBuilder: (_, index) {
|
|
return InkWell(
|
|
onTap: () {
|
|
DevicesCubit.get(context).selectCategory(index);
|
|
//Navigate to the chosen category view without animation
|
|
|
|
Navigator.push(context,
|
|
CustomPageRoute(builder: (context) {
|
|
return DevicesCubit.get(context)
|
|
.chosenCategoryView!;
|
|
}));
|
|
},
|
|
child: DefaultContainer(
|
|
child: Padding(
|
|
padding: const EdgeInsets.only(
|
|
top: 10, right: 10, left: 10),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment:
|
|
MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
SvgPicture.asset(
|
|
DevicesCubit.allCategories![index].icon!,
|
|
fit: BoxFit.contain,
|
|
),
|
|
// CustomSwitch(
|
|
],
|
|
),
|
|
Expanded(
|
|
child: FittedBox(
|
|
fit: BoxFit.scaleDown,
|
|
child: BodyLarge(
|
|
text: DevicesCubit
|
|
.allCategories![index].name!,
|
|
style: context.bodyLarge.copyWith(
|
|
fontWeight: FontWeight.bold,
|
|
height: 0,
|
|
fontSize: 24,
|
|
color: Colors.grey,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
},
|
|
)
|
|
: const SizedBox.shrink()
|
|
: const Center(
|
|
child: CircularProgressIndicator(),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|