diff --git a/example/lib/main.dart b/example/lib/main.dart index e08983d..97ac654 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -31,7 +31,7 @@ class Home extends StatelessWidget { } List getStartRoutes() => getStartStoryRoutes( - config, + configuration: config, ); StartUserStoryConfiguration config = StartUserStoryConfiguration( @@ -41,20 +41,20 @@ StartUserStoryConfiguration config = StartUserStoryConfiguration( ), introductionOptionsBuilder: (ctx) => IntroductionOptions( pages: [ - IntroductionPage( - title: const Text('First page'), - text: const Text('Wow a page'), - graphic: const FlutterLogo(), + const IntroductionPage( + title: Text('First page'), + text: Text('Wow a page'), + graphic: FlutterLogo(), ), - IntroductionPage( - title: const Text('Second page'), - text: const Text('Another page'), - graphic: const FlutterLogo(), + const IntroductionPage( + title: Text('Second page'), + text: Text('Another page'), + graphic: FlutterLogo(), ), - IntroductionPage( - title: const Text('Third page'), - text: const Text('The final page of this app'), - graphic: const FlutterLogo(), + const IntroductionPage( + title: Text('Third page'), + text: Text('The final page of this app'), + graphic: FlutterLogo(), ), ], introductionTranslations: const IntroductionTranslations( diff --git a/example/pubspec.yaml b/example/pubspec.yaml index a6f1a41..24e9014 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -14,7 +14,7 @@ dependencies: flutter_introduction_shared_preferences: git: url: https://github.com/Iconica-Development/flutter_introduction - ref: 2.1.0 + ref: 3.0.0 path: packages/flutter_introduction_shared_preferences dev_dependencies: diff --git a/lib/src/user_stories/flutter_start_userstory_go_router.dart b/lib/src/user_stories/flutter_start_userstory_go_router.dart index 5baa917..ae3fbfb 100644 --- a/lib/src/user_stories/flutter_start_userstory_go_router.dart +++ b/lib/src/user_stories/flutter_start_userstory_go_router.dart @@ -11,13 +11,13 @@ import 'package:flutter_start/src/go_router.dart'; import 'package:flutter_start/src/models/start_configuration.dart'; import 'package:flutter_start/src/routes.dart'; import 'package:flutter_start/src/services/killswitch_service.dart'; -import 'package:flutter_start/src/widgets/default_introduction_options.dart'; import 'package:flutter_start/src/widgets/default_splash_screen.dart'; import 'package:go_router/go_router.dart'; -List getStartStoryRoutes( - StartUserStoryConfiguration configuration, -) => +List getStartStoryRoutes({ + StartUserStoryConfiguration? configuration = + const StartUserStoryConfiguration(), +}) => [ GoRoute( path: StartUserStoryRoutes.splashScreen, @@ -32,7 +32,7 @@ List getStartStoryRoutes( Future.delayed( Duration.zero, () async { - if (configuration.useKillswitch) { + if (configuration!.useKillswitch) { var killswitchService = configuration.killswitchService ?? DefaultKillswitchService(); @@ -53,7 +53,7 @@ List getStartStoryRoutes( ), Future.delayed( Duration( - seconds: configuration.minimumSplashScreenDuration, + seconds: configuration!.minimumSplashScreenDuration, ), () async {}, ), @@ -70,7 +70,7 @@ List getStartStoryRoutes( return go(StartUserStoryRoutes.introduction); } - if (configuration.splashScreenBuilder == null) { + if (configuration!.splashScreenBuilder == null) { unawaited(splashLoadingMethod()); } return buildScreenWithoutTransition( @@ -95,7 +95,7 @@ List getStartStoryRoutes( path: StartUserStoryRoutes.introduction, pageBuilder: (context, state) { var introduction = Introduction( - service: configuration.introductionService ?? + service: configuration!.introductionService ?? IntroductionService( SharedPreferencesIntroductionDataProvider(), ), @@ -105,7 +105,7 @@ List getStartStoryRoutes( ); }, options: configuration.introductionOptionsBuilder?.call(context) ?? - defaultIntroductionOptions, + const IntroductionOptions(), physics: configuration.introductionScrollPhysics, child: configuration.introductionFallbackScreen, ); diff --git a/lib/src/user_stories/flutter_start_userstory_navigator.dart b/lib/src/user_stories/flutter_start_userstory_navigator.dart index b0073dd..5fc09fd 100644 --- a/lib/src/user_stories/flutter_start_userstory_navigator.dart +++ b/lib/src/user_stories/flutter_start_userstory_navigator.dart @@ -3,7 +3,6 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_start/flutter_start.dart'; import 'package:flutter_start/src/services/killswitch_service.dart'; -import 'package:flutter_start/src/widgets/default_introduction_options.dart'; import 'package:flutter_start/src/widgets/default_splash_screen.dart'; /// Initial screen of the user story. @@ -154,7 +153,7 @@ Widget _introduction( IntroductionService(SharedPreferencesIntroductionDataProvider()), navigateTo: () async => onComplete(context), options: configuration.introductionOptionsBuilder?.call(context) ?? - defaultIntroductionOptions, + const IntroductionOptions(), physics: configuration.introductionScrollPhysics, child: configuration.introductionFallbackScreen, ); diff --git a/lib/src/widgets/default_introduction_options.dart b/lib/src/widgets/default_introduction_options.dart deleted file mode 100644 index 440b0bd..0000000 --- a/lib/src/widgets/default_introduction_options.dart +++ /dev/null @@ -1,146 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_start/flutter_start.dart'; - -IntroductionOptions defaultIntroductionOptions = IntroductionOptions( - introductionTranslations: const IntroductionTranslations( - finishButton: 'Get Started', - nextButton: 'Next', - previousButton: 'Previous', - ), - buttonMode: IntroductionScreenButtonMode.text, - indicatorMode: IndicatorMode.dot, - buttonBuilder: (p0, p1, p2, p3) => defaultIntroductionButton(p0, p1, p2), - introductionButtonTextstyles: defaultIntroductionButtonTextstyles, - pages: defaultIntroductionPages, -); - -const titleStyle = TextStyle( - color: Color(0xff71C6D1), - fontSize: 24, - fontWeight: FontWeight.w700, -); - -final defaultIntroductionPages = [ - IntroductionPage( - decoration: const BoxDecoration( - color: Color(0xffFAF9F6), - ), - title: const Column( - children: [ - SizedBox(height: 100), - Text('welcome to iconinstagram', style: titleStyle), - SizedBox(height: 6), - Text( - 'Welcome to the world of Instagram, where creativity' - ' knows no bounds and connections are made' - ' through captivating visuals.', - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w400, - ), - textAlign: TextAlign.center, - ), - ], - ), - text: const Text(''), - ), - IntroductionPage( - decoration: const BoxDecoration( - color: Color(0xffFAF9F6), - ), - title: const Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SizedBox(height: 100), - Text( - 'discover iconinstagram', - style: titleStyle, - ), - SizedBox(height: 6), - Text( - 'Dive into the vibrant world of' - ' Instagram and discover endless possibilities.' - ' From stunning photography to engaging videos,' - ' Instagram offers a diverse range of content to explore and enjoy.', - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w400, - ), - textAlign: TextAlign.center, - ), - ], - ), - text: const Text(''), - ), - IntroductionPage( - decoration: const BoxDecoration( - color: Color(0xffFAF9F6), - ), - title: const Column( - children: [ - SizedBox(height: 100), - Text( - 'elevate your experience', - style: titleStyle, - ), - SizedBox(height: 6), - Text( - 'Whether promoting your business, or connecting' - ' with friends and family, Instagram provides the' - ' tools and platform to make your voice heard.', - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w400, - ), - textAlign: TextAlign.center, - ), - ], - ), - text: const Text(''), - ), -]; - -const defaultIntroductionButtonTextstyles = IntroductionButtonTextstyles( - finishButtonStyle: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w500, - ), - nextButtonStyle: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w500, - ), - previousButtonStyle: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w500, - ), - skipButtonStyle: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w500, - ), -); - -Widget defaultIntroductionButton( - BuildContext context, - void Function() onTap, - Widget buttonWidget, -) => - InkWell( - onTap: onTap, - child: Container( - width: 180, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(20), - border: Border.all( - color: const Color( - 0xff979797, - ), - ), - ), - child: Center( - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 2.0), - child: buttonWidget, - ), - ), - ), - ); diff --git a/pubspec.yaml b/pubspec.yaml index b965bf3..8782ac8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,12 +16,12 @@ dependencies: flutter_introduction: git: url: https://github.com/Iconica-Development/flutter_introduction - ref: 2.1.0 + ref: 3.0.0 path: packages/flutter_introduction flutter_introduction_shared_preferences: git: url: https://github.com/Iconica-Development/flutter_introduction - ref: 2.1.0 + ref: 3.0.0 path: packages/flutter_introduction_shared_preferences dev_dependencies: