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(
|
List<GoRoute> getStartRoutes() => getStartStoryRoutes(
|
||||||
config,
|
configuration: config,
|
||||||
);
|
);
|
||||||
|
|
||||||
StartUserStoryConfiguration config = StartUserStoryConfiguration(
|
StartUserStoryConfiguration config = StartUserStoryConfiguration(
|
||||||
|
@ -41,20 +41,20 @@ StartUserStoryConfiguration config = StartUserStoryConfiguration(
|
||||||
),
|
),
|
||||||
introductionOptionsBuilder: (ctx) => IntroductionOptions(
|
introductionOptionsBuilder: (ctx) => IntroductionOptions(
|
||||||
pages: [
|
pages: [
|
||||||
IntroductionPage(
|
const IntroductionPage(
|
||||||
title: const Text('First page'),
|
title: Text('First page'),
|
||||||
text: const Text('Wow a page'),
|
text: Text('Wow a page'),
|
||||||
graphic: const FlutterLogo(),
|
graphic: FlutterLogo(),
|
||||||
),
|
),
|
||||||
IntroductionPage(
|
const IntroductionPage(
|
||||||
title: const Text('Second page'),
|
title: Text('Second page'),
|
||||||
text: const Text('Another page'),
|
text: Text('Another page'),
|
||||||
graphic: const FlutterLogo(),
|
graphic: FlutterLogo(),
|
||||||
),
|
),
|
||||||
IntroductionPage(
|
const IntroductionPage(
|
||||||
title: const Text('Third page'),
|
title: Text('Third page'),
|
||||||
text: const Text('The final page of this app'),
|
text: Text('The final page of this app'),
|
||||||
graphic: const FlutterLogo(),
|
graphic: FlutterLogo(),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
introductionTranslations: const IntroductionTranslations(
|
introductionTranslations: const IntroductionTranslations(
|
||||||
|
|
|
@ -14,7 +14,7 @@ dependencies:
|
||||||
flutter_introduction_shared_preferences:
|
flutter_introduction_shared_preferences:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/Iconica-Development/flutter_introduction
|
url: https://github.com/Iconica-Development/flutter_introduction
|
||||||
ref: 2.1.0
|
ref: 3.0.0
|
||||||
path: packages/flutter_introduction_shared_preferences
|
path: packages/flutter_introduction_shared_preferences
|
||||||
|
|
||||||
dev_dependencies:
|
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/models/start_configuration.dart';
|
||||||
import 'package:flutter_start/src/routes.dart';
|
import 'package:flutter_start/src/routes.dart';
|
||||||
import 'package:flutter_start/src/services/killswitch_service.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:flutter_start/src/widgets/default_splash_screen.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
|
||||||
List<GoRoute> getStartStoryRoutes(
|
List<GoRoute> getStartStoryRoutes({
|
||||||
StartUserStoryConfiguration configuration,
|
StartUserStoryConfiguration? configuration =
|
||||||
) =>
|
const StartUserStoryConfiguration(),
|
||||||
|
}) =>
|
||||||
<GoRoute>[
|
<GoRoute>[
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: StartUserStoryRoutes.splashScreen,
|
path: StartUserStoryRoutes.splashScreen,
|
||||||
|
@ -32,7 +32,7 @@ List<GoRoute> getStartStoryRoutes(
|
||||||
Future.delayed(
|
Future.delayed(
|
||||||
Duration.zero,
|
Duration.zero,
|
||||||
() async {
|
() async {
|
||||||
if (configuration.useKillswitch) {
|
if (configuration!.useKillswitch) {
|
||||||
var killswitchService = configuration.killswitchService ??
|
var killswitchService = configuration.killswitchService ??
|
||||||
DefaultKillswitchService();
|
DefaultKillswitchService();
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ List<GoRoute> getStartStoryRoutes(
|
||||||
),
|
),
|
||||||
Future.delayed(
|
Future.delayed(
|
||||||
Duration(
|
Duration(
|
||||||
seconds: configuration.minimumSplashScreenDuration,
|
seconds: configuration!.minimumSplashScreenDuration,
|
||||||
),
|
),
|
||||||
() async {},
|
() async {},
|
||||||
),
|
),
|
||||||
|
@ -70,7 +70,7 @@ List<GoRoute> getStartStoryRoutes(
|
||||||
return go(StartUserStoryRoutes.introduction);
|
return go(StartUserStoryRoutes.introduction);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (configuration.splashScreenBuilder == null) {
|
if (configuration!.splashScreenBuilder == null) {
|
||||||
unawaited(splashLoadingMethod());
|
unawaited(splashLoadingMethod());
|
||||||
}
|
}
|
||||||
return buildScreenWithoutTransition(
|
return buildScreenWithoutTransition(
|
||||||
|
@ -95,7 +95,7 @@ List<GoRoute> getStartStoryRoutes(
|
||||||
path: StartUserStoryRoutes.introduction,
|
path: StartUserStoryRoutes.introduction,
|
||||||
pageBuilder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
var introduction = Introduction(
|
var introduction = Introduction(
|
||||||
service: configuration.introductionService ??
|
service: configuration!.introductionService ??
|
||||||
IntroductionService(
|
IntroductionService(
|
||||||
SharedPreferencesIntroductionDataProvider(),
|
SharedPreferencesIntroductionDataProvider(),
|
||||||
),
|
),
|
||||||
|
@ -105,7 +105,7 @@ List<GoRoute> getStartStoryRoutes(
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
options: configuration.introductionOptionsBuilder?.call(context) ??
|
options: configuration.introductionOptionsBuilder?.call(context) ??
|
||||||
defaultIntroductionOptions,
|
const IntroductionOptions(),
|
||||||
physics: configuration.introductionScrollPhysics,
|
physics: configuration.introductionScrollPhysics,
|
||||||
child: configuration.introductionFallbackScreen,
|
child: configuration.introductionFallbackScreen,
|
||||||
);
|
);
|
||||||
|
|
|
@ -3,7 +3,6 @@ import 'dart:async';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_start/flutter_start.dart';
|
import 'package:flutter_start/flutter_start.dart';
|
||||||
import 'package:flutter_start/src/services/killswitch_service.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:flutter_start/src/widgets/default_splash_screen.dart';
|
||||||
|
|
||||||
/// Initial screen of the user story.
|
/// Initial screen of the user story.
|
||||||
|
@ -154,7 +153,7 @@ Widget _introduction(
|
||||||
IntroductionService(SharedPreferencesIntroductionDataProvider()),
|
IntroductionService(SharedPreferencesIntroductionDataProvider()),
|
||||||
navigateTo: () async => onComplete(context),
|
navigateTo: () async => onComplete(context),
|
||||||
options: configuration.introductionOptionsBuilder?.call(context) ??
|
options: configuration.introductionOptionsBuilder?.call(context) ??
|
||||||
defaultIntroductionOptions,
|
const IntroductionOptions(),
|
||||||
physics: configuration.introductionScrollPhysics,
|
physics: configuration.introductionScrollPhysics,
|
||||||
child: configuration.introductionFallbackScreen,
|
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:
|
flutter_introduction:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/Iconica-Development/flutter_introduction
|
url: https://github.com/Iconica-Development/flutter_introduction
|
||||||
ref: 2.1.0
|
ref: 3.0.0
|
||||||
path: packages/flutter_introduction
|
path: packages/flutter_introduction
|
||||||
flutter_introduction_shared_preferences:
|
flutter_introduction_shared_preferences:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/Iconica-Development/flutter_introduction
|
url: https://github.com/Iconica-Development/flutter_introduction
|
||||||
ref: 2.1.0
|
ref: 3.0.0
|
||||||
path: packages/flutter_introduction_shared_preferences
|
path: packages/flutter_introduction_shared_preferences
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
|
Loading…
Reference in a new issue