mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 09:45:22 +00:00
added smooth_page_indicator for devices view body
This commit is contained in:
@ -16,9 +16,7 @@ class AcInterfaceControls extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Expanded(
|
||||
flex: 3,
|
||||
child: Column(
|
||||
return Column(
|
||||
children: [
|
||||
const SizedBox(height: 10),
|
||||
ACModeControlUnit(model: acModel),
|
||||
@ -51,7 +49,6 @@ class AcInterfaceControls extends StatelessWidget {
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -4,14 +4,14 @@ import 'package:syncrow_app/features/devices/view/widgets/switches.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/title_medium.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/strings_manager.dart';
|
||||
|
||||
class CategoriesView extends StatelessWidget {
|
||||
const CategoriesView({
|
||||
class DevicesCategoriesView extends StatelessWidget {
|
||||
const DevicesCategoriesView({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Column(
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
@ -1,8 +1,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/categories_view.dart';
|
||||
import 'package:smooth_page_indicator/smooth_page_indicator.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/devices_categories_view.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/title_medium.dart';
|
||||
|
||||
import '../../../../utils/resource_manager/strings_manager.dart';
|
||||
import '../../bloc/devices_cubit.dart';
|
||||
import 'switches.dart';
|
||||
|
||||
class DevicesViewBody extends StatelessWidget {
|
||||
const DevicesViewBody({
|
||||
@ -15,9 +19,101 @@ class DevicesViewBody extends StatelessWidget {
|
||||
create: (context) => DevicesCubit(),
|
||||
child: BlocBuilder<DevicesCubit, DevicesState>(
|
||||
builder: (context, state) {
|
||||
PageController pageController = PageController();
|
||||
return state is DevicesLoading
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: const CategoriesView();
|
||||
: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
height: MediaQuery.sizeOf(context).height - 252,
|
||||
child: PageView(
|
||||
controller: pageController,
|
||||
children: const [
|
||||
DevicesCategoriesView(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TitleMedium(
|
||||
text: "Home",
|
||||
style: TextStyle(
|
||||
fontSize: 32,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
TitleMedium(
|
||||
text: StringsManager.wizard,
|
||||
style: TextStyle(
|
||||
fontSize: 28,
|
||||
),
|
||||
),
|
||||
Switches(),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TitleMedium(
|
||||
text: "Office",
|
||||
style: TextStyle(
|
||||
fontSize: 32,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
TitleMedium(
|
||||
text: StringsManager.wizard,
|
||||
style: TextStyle(
|
||||
fontSize: 28,
|
||||
),
|
||||
),
|
||||
Switches(),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SmoothPageIndicator(
|
||||
controller: pageController,
|
||||
count: 3,
|
||||
effect: const WormEffect()),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
@ -5,6 +5,7 @@ import 'package:syncrow_app/features/shared_widgets/custom_switch.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';
|
||||
|
||||
@ -32,7 +33,9 @@ class Switches extends StatelessWidget {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
DevicesCubit.get(context).selectCategory(index);
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) {
|
||||
//Navigate to the chosen category view without animation
|
||||
|
||||
Navigator.push(context, CustomPageRoute(builder: (context) {
|
||||
return DevicesCubit.get(context).chosenCategoryView!;
|
||||
}));
|
||||
},
|
||||
|
11
lib/utils/helpers/custom_page_route.dart
Normal file
11
lib/utils/helpers/custom_page_route.dart
Normal file
@ -0,0 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CustomPageRoute extends MaterialPageRoute {
|
||||
CustomPageRoute({
|
||||
required super.builder,
|
||||
super.settings,
|
||||
});
|
||||
|
||||
@override
|
||||
Duration get transitionDuration => const Duration(milliseconds: 0);
|
||||
}
|
@ -634,6 +634,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
smooth_page_indicator:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: smooth_page_indicator
|
||||
sha256: "725bc638d5e79df0c84658e1291449996943f93bacbc2cec49963dbbab48d8ae"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
source_span:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -25,6 +25,7 @@ dependencies:
|
||||
flutter_secure_storage: ^9.0.0
|
||||
cached_network_image: ^3.3.1
|
||||
flutter_dotenv: ^5.1.0
|
||||
# noinspection YAMLSchemaValidation
|
||||
intl: ^0.18.0
|
||||
get_it: ^7.6.7
|
||||
url_launcher: ^6.2.5
|
||||
@ -34,6 +35,7 @@ dependencies:
|
||||
firebase_core: ^2.25.5
|
||||
firebase_analytics: ^10.8.7
|
||||
firebase_crashlytics: ^3.4.16
|
||||
smooth_page_indicator: ^1.1.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
Reference in New Issue
Block a user