mirror of
https://github.com/Iconica-Development/flutter_start.git
synced 2025-05-18 18:13:45 +02:00
feat: add default styling
This commit is contained in:
parent
fc65e98f96
commit
90eb8119d8
6 changed files with 26 additions and 173 deletions
|
@ -31,7 +31,7 @@ class Home extends StatelessWidget {
|
|||
}
|
||||
|
||||
List<GoRoute> 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(
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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<GoRoute> getStartStoryRoutes(
|
||||
StartUserStoryConfiguration configuration,
|
||||
) =>
|
||||
List<GoRoute> getStartStoryRoutes({
|
||||
StartUserStoryConfiguration? configuration =
|
||||
const StartUserStoryConfiguration(),
|
||||
}) =>
|
||||
<GoRoute>[
|
||||
GoRoute(
|
||||
path: StartUserStoryRoutes.splashScreen,
|
||||
|
@ -32,7 +32,7 @@ List<GoRoute> getStartStoryRoutes(
|
|||
Future.delayed(
|
||||
Duration.zero,
|
||||
() async {
|
||||
if (configuration.useKillswitch) {
|
||||
if (configuration!.useKillswitch) {
|
||||
var killswitchService = configuration.killswitchService ??
|
||||
DefaultKillswitchService();
|
||||
|
||||
|
@ -53,7 +53,7 @@ List<GoRoute> getStartStoryRoutes(
|
|||
),
|
||||
Future.delayed(
|
||||
Duration(
|
||||
seconds: configuration.minimumSplashScreenDuration,
|
||||
seconds: configuration!.minimumSplashScreenDuration,
|
||||
),
|
||||
() async {},
|
||||
),
|
||||
|
@ -70,7 +70,7 @@ List<GoRoute> getStartStoryRoutes(
|
|||
return go(StartUserStoryRoutes.introduction);
|
||||
}
|
||||
|
||||
if (configuration.splashScreenBuilder == null) {
|
||||
if (configuration!.splashScreenBuilder == null) {
|
||||
unawaited(splashLoadingMethod());
|
||||
}
|
||||
return buildScreenWithoutTransition(
|
||||
|
@ -95,7 +95,7 @@ List<GoRoute> getStartStoryRoutes(
|
|||
path: StartUserStoryRoutes.introduction,
|
||||
pageBuilder: (context, state) {
|
||||
var introduction = Introduction(
|
||||
service: configuration.introductionService ??
|
||||
service: configuration!.introductionService ??
|
||||
IntroductionService(
|
||||
SharedPreferencesIntroductionDataProvider(),
|
||||
),
|
||||
|
@ -105,7 +105,7 @@ List<GoRoute> getStartStoryRoutes(
|
|||
);
|
||||
},
|
||||
options: configuration.introductionOptionsBuilder?.call(context) ??
|
||||
defaultIntroductionOptions,
|
||||
const IntroductionOptions(),
|
||||
physics: configuration.introductionScrollPhysics,
|
||||
child: configuration.introductionFallbackScreen,
|
||||
);
|
||||
|
|
|
@ -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,
|
||||
);
|
||||
|
|
|
@ -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,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue