mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 17:47:28 +00:00
added smooth_page_indicator for devices view body
This commit is contained in:
@ -16,42 +16,39 @@ class AcInterfaceControls extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Expanded(
|
return Column(
|
||||||
flex: 3,
|
children: [
|
||||||
child: Column(
|
const SizedBox(height: 10),
|
||||||
children: [
|
ACModeControlUnit(model: acModel),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
ACModeControlUnit(model: acModel),
|
Row(
|
||||||
const SizedBox(height: 10),
|
children: [
|
||||||
Row(
|
Expanded(
|
||||||
children: [
|
child: InkWell(
|
||||||
Expanded(
|
onTap: () {},
|
||||||
child: InkWell(
|
child: DefaultContainer(
|
||||||
onTap: () {},
|
height: 55,
|
||||||
child: DefaultContainer(
|
child: Center(
|
||||||
height: 55,
|
child: SvgPicture.asset(Assets.iconsAutomatedClock),
|
||||||
child: Center(
|
|
||||||
child: SvgPicture.asset(Assets.iconsAutomatedClock),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
),
|
||||||
Expanded(
|
const SizedBox(width: 10),
|
||||||
child: InkWell(
|
Expanded(
|
||||||
onTap: () {},
|
child: InkWell(
|
||||||
child: DefaultContainer(
|
onTap: () {},
|
||||||
height: 55,
|
child: DefaultContainer(
|
||||||
child: Center(
|
height: 55,
|
||||||
child: SvgPicture.asset(Assets.iconsLock),
|
child: Center(
|
||||||
),
|
child: SvgPicture.asset(Assets.iconsLock),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
)
|
],
|
||||||
],
|
)
|
||||||
),
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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/features/shared_widgets/text_widgets/title_medium.dart';
|
||||||
import 'package:syncrow_app/utils/resource_manager/strings_manager.dart';
|
import 'package:syncrow_app/utils/resource_manager/strings_manager.dart';
|
||||||
|
|
||||||
class CategoriesView extends StatelessWidget {
|
class DevicesCategoriesView extends StatelessWidget {
|
||||||
const CategoriesView({
|
const DevicesCategoriesView({
|
||||||
super.key,
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return const Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
@ -1,8 +1,12 @@
|
|||||||
import 'package:flutter/material.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/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 '../../bloc/devices_cubit.dart';
|
||||||
|
import 'switches.dart';
|
||||||
|
|
||||||
class DevicesViewBody extends StatelessWidget {
|
class DevicesViewBody extends StatelessWidget {
|
||||||
const DevicesViewBody({
|
const DevicesViewBody({
|
||||||
@ -15,9 +19,101 @@ class DevicesViewBody extends StatelessWidget {
|
|||||||
create: (context) => DevicesCubit(),
|
create: (context) => DevicesCubit(),
|
||||||
child: BlocBuilder<DevicesCubit, DevicesState>(
|
child: BlocBuilder<DevicesCubit, DevicesState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
|
PageController pageController = PageController();
|
||||||
return state is DevicesLoading
|
return state is DevicesLoading
|
||||||
? const Center(child: CircularProgressIndicator())
|
? 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/default_container.dart';
|
||||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.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/context_extension.dart';
|
||||||
|
import 'package:syncrow_app/utils/helpers/custom_page_route.dart';
|
||||||
|
|
||||||
import '../../bloc/devices_cubit.dart';
|
import '../../bloc/devices_cubit.dart';
|
||||||
|
|
||||||
@ -32,7 +33,9 @@ class Switches extends StatelessWidget {
|
|||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
DevicesCubit.get(context).selectCategory(index);
|
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!;
|
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"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.1"
|
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:
|
source_span:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -25,6 +25,7 @@ dependencies:
|
|||||||
flutter_secure_storage: ^9.0.0
|
flutter_secure_storage: ^9.0.0
|
||||||
cached_network_image: ^3.3.1
|
cached_network_image: ^3.3.1
|
||||||
flutter_dotenv: ^5.1.0
|
flutter_dotenv: ^5.1.0
|
||||||
|
# noinspection YAMLSchemaValidation
|
||||||
intl: ^0.18.0
|
intl: ^0.18.0
|
||||||
get_it: ^7.6.7
|
get_it: ^7.6.7
|
||||||
url_launcher: ^6.2.5
|
url_launcher: ^6.2.5
|
||||||
@ -34,6 +35,7 @@ dependencies:
|
|||||||
firebase_core: ^2.25.5
|
firebase_core: ^2.25.5
|
||||||
firebase_analytics: ^10.8.7
|
firebase_analytics: ^10.8.7
|
||||||
firebase_crashlytics: ^3.4.16
|
firebase_crashlytics: ^3.4.16
|
||||||
|
smooth_page_indicator: ^1.1.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
Reference in New Issue
Block a user