proxybuy-flutter/lib/screens/auth/onboarding.dart

107 lines
3.1 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:lba/gen/assets.gen.dart';
import 'package:lba/screens/auth/login.dart';
class OnboardingScreen extends StatefulWidget {
const OnboardingScreen({super.key});
@override
State<OnboardingScreen> createState() => _OnboardingScreenState();
}
class _OnboardingScreenState extends State<OnboardingScreen> {
int currentIndex = 0;
final List<String> imageAssets = [
Assets.images.ounboarding1.path,
Assets.images.frame.path,
Assets.images.onboarding3.path,
];
final List<String> slides = [
Assets.icons.slides1.path,
Assets.icons.slide2.path,
Assets.icons.slide3.path,
];
void _next() {
if (currentIndex < imageAssets.length - 1) {
setState(() {
currentIndex++;
});
} else {
Navigator.push(context, MaterialPageRoute(builder: (context) => Login(),));
}
}
void _back() {
if (currentIndex > 0) {
setState(() {
currentIndex--;
});
}
}
@override
Widget build(BuildContext context) {
var sizeScreen = MediaQuery.of(context).size;
return Scaffold(
body: Column(
children: [
Padding(
padding: const EdgeInsets.fromLTRB(50, 150, 50, 100),
child: SvgPicture.asset(imageAssets[currentIndex]),
),
Padding(
padding: EdgeInsets.fromLTRB(sizeScreen.width/15, 10, sizeScreen.width/15, 5),
child: Row(
children: [
Text(
"Proxibuy Geofencing marketing",
style: TextStyle(fontWeight: FontWeight.w900),
textDirection: TextDirection.ltr,
),
],
),
),
Padding(
padding: EdgeInsets.fromLTRB(sizeScreen.width/15, 10, sizeScreen.width/15, sizeScreen.height/40),
child: Text(
'"Join the app to discover exclusive discounts and special offers in specific areas around you for a smarter shopping experience!"',
style: TextStyle(fontWeight: FontWeight.w500,color: const Color.fromARGB(255, 88, 88, 88)),
),
),
const SizedBox(height: 50),
Padding(
padding: EdgeInsets.fromLTRB(sizeScreen.width/15, 10, sizeScreen.width/15, sizeScreen.height/40),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SvgPicture.asset(slides[currentIndex]),
Row(
children: [
if (currentIndex > 0)
GestureDetector(
onTap: _back,
child: SvgPicture.asset(Assets.icons.arrowLeft.path),
),
const SizedBox(width: 8),
GestureDetector(
onTap: _next,
child: SvgPicture.asset(Assets.icons.next.path),
),
],
)
],
),
)
],
),
);
}
}