Open hossam20520 opened 1 year ago
class HomeScreen extends StatelessWidget { final PageController _pageController = PageController();
HomeScreen({super.key}); @override Widget build(BuildContext context) { return Scaffold( body: OnBoard( pageController: _pageController, // Either Provide onSkip Callback or skipButton Widget to handle skip state onSkip: () { // print('skipped'); // log('your message here'); }, // Either Provide onDone Callback or nextButton Widget to handle done state onDone: () { print('done'); // log('your message here'); // Navigator.push( // context, // MaterialPageRoute(builder: (context) => const ProductsScreen()), // ); }, onBoardData: onBoardData, titleStyles: const TextStyle( color: Color.fromARGB(255, 0, 0, 0), fontSize: 18, fontWeight: FontWeight.w900, letterSpacing: 0.15,
), descriptionStyles: const TextStyle( fontSize: 16, color: Color.fromARGB(255, 0, 0, 0), ), pageIndicatorStyle: const PageIndicatorStyle( width: 100, inactiveColor: Color.fromARGB(255, 0, 177, 255), activeColor: Color.fromARGB(255, 9, 122, 170), inactiveSize: Size(8, 8), activeSize: Size(12, 12), ), // Either Provide onSkip Callback or skipButton Widget to handle skip state skipButton: TextButton( onPressed: () { // print('skipButton pressed'); }, child: const Text( "تخطى", style: TextStyle(color: Color.fromARGB(255, 0, 0, 0) , fontSize: 24, ), ), ), // Either Provide onDone Callback or nextButton Widget to handle done state nextButton: OnBoardConsumer( builder: (context, ref, child) { final state = ref.watch(onBoardStateProvider); return InkWell( onTap: () => _onNextTap(state), child: Container( width: 230, height: 50, alignment: Alignment.center, decoration: BoxDecoration( borderRadius: BorderRadius.circular(30), gradient: const LinearGradient( colors: [Color.fromARGB(255, 9, 135, 189), Color.fromARGB(255, 0, 177, 255)], ), ), child: Text( state.isLastPage ? "حسنا" : "التالي", style: const TextStyle( color: Colors.white, fontWeight: FontWeight.bold, ), ), ), ); }, ), ), );
}
void _onNextTap(OnBoardState onBoardState) { if (!onBoardState.isLastPage) { _pageController.animateToPage( onBoardState.page + 1, duration: const Duration(milliseconds: 250), curve: Curves.easeInOutSine, ); } else { //print("nextButton pressed"); } } }
class HomeScreen extends StatelessWidget { final PageController _pageController = PageController();
HomeScreen({super.key}); @override Widget build(BuildContext context) { return Scaffold( body: OnBoard( pageController: _pageController, // Either Provide onSkip Callback or skipButton Widget to handle skip state onSkip: () { // print('skipped'); // log('your message here'); }, // Either Provide onDone Callback or nextButton Widget to handle done state onDone: () { print('done'); // log('your message here'); // Navigator.push( // context, // MaterialPageRoute(builder: (context) => const ProductsScreen()), // ); }, onBoardData: onBoardData, titleStyles: const TextStyle( color: Color.fromARGB(255, 0, 0, 0), fontSize: 18, fontWeight: FontWeight.w900, letterSpacing: 0.15,
}
void _onNextTap(OnBoardState onBoardState) { if (!onBoardState.isLastPage) { _pageController.animateToPage( onBoardState.page + 1, duration: const Duration(milliseconds: 250), curve: Curves.easeInOutSine, ); } else { //print("nextButton pressed"); } } }