Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] Add a welcome screen that generates random quotes #268

Merged
merged 15 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/app/routes/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ import 'package:dairy_app/features/notes/presentation/pages/note_create_page.dar
import 'package:dairy_app/features/notes/presentation/pages/note_read_only_page.dart';
import 'package:dairy_app/generated/l10n.dart';
import 'package:flutter/material.dart';
import 'package:dairy_app/core/pages/welcome_page.dart';

class RouteGenerator {
static Route<dynamic> generateRoute(RouteSettings settings) {
final args = settings.arguments;
final log = printer("Router");

log.i("routing to ${settings.name} with args $args");

if (settings.name == HomePage.route) {
if (settings.name == WelcomePage.route) {
return MaterialPageRoute(builder: (_) => const WelcomePage());
} else if (settings.name == HomePage.route) {
return MaterialPageRoute(builder: (_) => const HomePage());
} else if (settings.name == AuthPage.route) {
return MaterialPageRoute(builder: (_) => AuthPage());
Expand Down
4 changes: 2 additions & 2 deletions lib/app/view/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import 'package:dairy_app/app/themes/plain_dark.dart';
import 'package:dairy_app/core/dependency_injection/injection_container.dart';
import 'package:dairy_app/core/logger/logger.dart';
import 'package:dairy_app/core/pages/home_page.dart';
import 'package:dairy_app/core/pages/welcome_page.dart';
import 'package:dairy_app/features/auth/data/repositories/pin_auth_repository.dart';
import 'package:dairy_app/features/auth/presentation/bloc/auth_form/auth_form_bloc.dart';
import 'package:dairy_app/features/auth/presentation/bloc/auth_session/auth_session_bloc.dart';
import 'package:dairy_app/features/auth/presentation/bloc/font/font_cubit.dart';
import 'package:dairy_app/features/auth/presentation/bloc/locale/locale_cubit.dart';
import 'package:dairy_app/features/auth/presentation/bloc/theme/theme_cubit.dart';
import 'package:dairy_app/features/auth/presentation/bloc/user_config/user_config_cubit.dart';
import 'package:dairy_app/features/auth/presentation/pages/auth_page.dart';
import 'package:dairy_app/features/auth/presentation/pages/pin_auth_page.dart';
import 'package:dairy_app/features/notes/presentation/bloc/notes/notes_bloc.dart';
import 'package:dairy_app/features/notes/presentation/bloc/notes_fetch/notes_fetch_cubit.dart';
Expand Down Expand Up @@ -157,7 +157,7 @@ class _AppViewState extends State<AppView> {
(route) => false);
} else {
_navigator.pushAndRemoveUntil(
MaterialPageRoute(builder: (_) => AuthPage()),
MaterialPageRoute(builder: (_) => const WelcomePage()),
(route) => false);
}
} else if (state is Authenticated) {
Expand Down
66 changes: 66 additions & 0 deletions lib/core/data/quotes.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
class Quotes {
static const List<String> quotes = [
// Writing and Journaling Specific Quotes
"Every page is a new beginning, waiting to be written.",
"Your story matters. Write it with courage and honesty.",
"In the quiet moments of reflection, truth emerges.",
"This journal is a map of your journey, with blank spaces yet to be explored.",
"Memories fade, but words preserve the essence of who we are.",
"Writing is how we listen to ourselves.",
"Today's thoughts become tomorrow's memories.",
"Your experiences are the ink, and this journal is your canvas.",
"Breathe life into your thoughts, one page at a time.",
"Vulnerability is strength when written in truth.",
"Every entry is a conversation with your future self.",
"Words are the bridges between your present and your potential.",
"Your journal is a sanctuary of unfiltered truth.",
"Write without fear, edit without mercy.",
"Each page is a step towards understanding yourself.",

// Motivational and Inspirational Quotes
"Believe you can and you're halfway there.",
"The only way to do great work is to love what you do.",
"Your life is your story. Write well. Edit often.",
"Every day is a chance to begin again.",
"You are capable of amazing things.",
"The future belongs to those who believe in the beauty of their dreams.",
"Start where you are. Use what you have. Do what you can.",
"Your potential is limited only by your imagination.",
"Small steps every day lead to big changes.",
"You are stronger than you think.",
"Growth happens outside of your comfort zone.",
"Your journey is unique and beautiful.",
"Embrace the glorious mess that you are.",
"Progress, not perfection.",
"You are the author of your own life.",

// Self-Reflection and Personal Growth Quotes
"Know yourself. Love yourself. Be yourself.",
"Reflection is the lamp of the heart.",
"Understanding yourself is the beginning of wisdom.",
"Your thoughts are the architects of your destiny.",
"Honesty with yourself is the foundation of all growth.",
"Healing begins with a single honest word.",
"Every challenge is an opportunity to grow.",
"Listen to your inner voice.",
"Self-discovery is the greatest adventure.",
"Your emotions are valid. Your experiences matter.",
"Kindness begins with being kind to yourself.",
"Transform your narrative, transform your life.",
"In silence, you'll find your truest self.",
"Vulnerability is not weakness, it's courage.",
"You are constantly becoming.",

// Additional Motivational Quotes
"Dream big. Start small. Begin now.",
"Your attitude determines your direction.",
"Every day is a gift, that's why it's called the present.",
"Courage doesn't always roar. Sometimes it's the quiet voice saying 'I'll try again tomorrow'.",
"You are enough, just as you are.",
"Create the things you wish existed.",
"Life is 10% what happens to you and 90% how you react to it.",
"The best time to plant a tree was 20 years ago. The second best time is now.",
"Your limitations are only in your mind.",
"Keep going. Every step counts."
];
}
86 changes: 86 additions & 0 deletions lib/core/pages/welcome_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import 'dart:math';

import 'package:dairy_app/core/data/quotes.dart';
import 'package:dairy_app/features/auth/presentation/pages/auth_page.dart';
import 'package:flutter/material.dart';

class WelcomePage extends StatefulWidget {
static String get route => '/';

const WelcomePage({Key? key}) : super(key: key);

@override
_WelcomePageState createState() => _WelcomePageState();
}

class _WelcomePageState extends State<WelcomePage> {
late String quote;

@override
void initState() {
super.initState();
// Initialize the quote
quote = getQuote();

// Add a delay to navigate after displaying the quote
Future.delayed(const Duration(seconds: 2), () {
Navigator.of(context).pushNamed(AuthPage.route);
});
}

String getQuote() {
const quotes = Quotes.quotes;
final random = Random();
return quotes[random.nextInt(quotes.length)];
}

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xFF9E8BD9), // Set background color
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
// Application logo
SizedBox(
width: 150,
height: 150,
child: ClipOval(
// Crop image in oval shape to match homepage logo
child: Transform.scale(
scale: 1.5, // Increase the scale to crop more from the image
child: Image.asset(
'assets/images/splash_icon_4.webp',
errorBuilder: (context, error, stackTrace) {
return const Text(
'Error loading image',
style: TextStyle(color: Colors.red),
);
},
fit: BoxFit
.cover, // Ensures the image fills the circular frame
),
),
),
),
const SizedBox(height: 20),
// Display the random quote
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Text(
quote,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 18,
color: Colors.white,
fontStyle: FontStyle.italic,
),
),
),
],
),
),
);
}
}
Loading