diff --git a/lib/features/MainScreens/Portfolio/presentation/pages/detailsScreen.dart b/lib/features/MainScreens/Portfolio/presentation/pages/detailsScreen.dart index 2bedda2..ea2de62 100644 --- a/lib/features/MainScreens/Portfolio/presentation/pages/detailsScreen.dart +++ b/lib/features/MainScreens/Portfolio/presentation/pages/detailsScreen.dart @@ -1,3 +1,4 @@ +import 'package:carousel_slider/carousel_slider.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:google_fonts/google_fonts.dart'; @@ -11,6 +12,16 @@ class DetailsScreen extends StatefulWidget { } class _DetailsScreenState extends State { + int _current = 0; + final CarouselController _controller = CarouselController(); + final List imgList = [ + {'id': 1, 'img_path': 'assets/images/portfolio_screen/detailsbg.png'}, + {'id': 2, 'img_path': 'assets/images/portfolio_screen/detailsbg.png'}, + {'id': 3, 'img_path': 'assets/images/portfolio_screen/detailsbg.png'}, + {'id': 4, 'img_path': 'assets/images/portfolio_screen/detailsbg.png'}, + {'id': 5, 'img_path': 'assets/images/portfolio_screen/detailsbg.png'}, + ]; + @override Widget build(BuildContext context) { return Scaffold( @@ -54,13 +65,58 @@ class _DetailsScreenState extends State { topLeft: Radius.circular(20.0), topRight: Radius.circular(20.0), ), - child: Image.asset( - 'assets/images/portfolio_screen/detailsbg.png', - fit: BoxFit.cover, - width: double.infinity, - alignment: Alignment.topCenter, + child: CarouselSlider( + items: imgList + .map( + (item) => Image.asset( + item['img_path'], + fit: BoxFit.cover, + width: double.infinity, + alignment: Alignment.topCenter, + ), + ) + .toList(), + carouselController: _controller, + options: CarouselOptions( + scrollPhysics: const BouncingScrollPhysics(), + autoPlay: true, + aspectRatio: 2, + viewportFraction: 1, + onPageChanged: (index, reason) { + setState(() { + _current = index; + }); + }), ), ), + Align( + alignment: Alignment.bottomCenter, + child: Padding( + padding: const EdgeInsets.only(bottom: 17.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: + imgList.asMap().entries.map((entry) { + return GestureDetector( + onTap: () => + _controller.animateToPage(entry.key), + child: Container( + width: 20.w, + height: 7.h, + margin: const EdgeInsets.symmetric( + horizontal: 3.0), + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(10), + color: (_current == entry.key) + ? Colors.white + : Colors.grey, + ), + ), + ); + }).toList(), + ), + )), Positioned( top: 20, left: 20, diff --git a/lib/features/login/presentation/widgets/bottom_section.dart b/lib/features/login/presentation/widgets/bottom_section.dart index 8fc6017..2b14677 100644 --- a/lib/features/login/presentation/widgets/bottom_section.dart +++ b/lib/features/login/presentation/widgets/bottom_section.dart @@ -45,7 +45,8 @@ class BottomSection extends StatelessWidget { successToastMessage(context, "login successful !"); goRouter.pop(); - goRouter.goNamed(RouteName.biometricScreen); + // goRouter.goNamed(RouteName.biometricScreen); + goRouter.goNamed(RouteName.mainScreen); } else if (state is LoginFailure) { goRouter.pop(); errorToastMessage( diff --git a/pubspec.lock b/pubspec.lock index 1397c28..e5d578e 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -105,6 +105,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.0" + carousel_slider: + dependency: "direct main" + description: + name: carousel_slider + sha256: "9c695cc963bf1d04a47bd6021f68befce8970bcd61d24938e1fb0918cf5d9c42" + url: "https://pub.dev" + source: hosted + version: "4.2.1" characters: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 832b797..82853ca 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -76,6 +76,7 @@ dependencies: #OTP Autofill sms_autofill: ^2.3.1 + carousel_slider: ^4.2.1 dev_dependencies: flutter_test: