diff --git a/lib/components/my_about_dialog.dart b/lib/components/my_about_dialog.dart index dca66e0..351de35 100644 --- a/lib/components/my_about_dialog.dart +++ b/lib/components/my_about_dialog.dart @@ -1,3 +1,4 @@ +import 'package:cofounderella/components/text_bold.dart'; import 'package:flutter/material.dart'; import '../constants.dart'; @@ -25,13 +26,7 @@ class MyAboutDialog extends StatelessWidget { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - Constants.appTitle, - style: TextStyle( - fontSize: 24, - fontWeight: FontWeight.bold, - ), - ), + TextBold(text: Constants.appTitle, fontSize: 24), Text( 'Version ${Constants.appVersion} (${Constants.appCompilationDate})'), ], diff --git a/lib/components/text_bold.dart b/lib/components/text_bold.dart new file mode 100644 index 0000000..1e55fc5 --- /dev/null +++ b/lib/components/text_bold.dart @@ -0,0 +1,32 @@ +import 'package:flutter/material.dart'; + +/// Text in bold. +/// +/// Unless specified otherwise, the default settings will be +/// fontSize: [18] and fontWeight: [FontWeight.bold]. +class TextBold extends StatelessWidget { + final String text; + final double? fontSize; + final FontWeight? fontWeight; + final TextAlign? textAlign; + + const TextBold({ + super.key, + required this.text, + this.fontSize = 18, + this.fontWeight = FontWeight.bold, + this.textAlign, + }); + + @override + Widget build(BuildContext context) { + return Text( + text, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: fontSize, + ), + textAlign: textAlign, + ); + } +} diff --git a/lib/forms/corporate_culture_form.dart b/lib/forms/corporate_culture_form.dart index 3a91b7b..0d4e3e8 100644 --- a/lib/forms/corporate_culture_form.dart +++ b/lib/forms/corporate_culture_form.dart @@ -1,6 +1,7 @@ import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:collection/collection.dart'; import 'package:flutter/material.dart'; +import '../components/text_bold.dart'; import '../constants.dart'; import '../enumerations.dart'; import '../forms/risks_form.dart'; @@ -156,10 +157,7 @@ class CultureValuesFormPageState extends State { child: SingleChildScrollView( child: Column( children: [ - const Text( - 'Work life and corporate culture', - style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), + const TextBold(text: 'Work life and corporate culture'), const Align( alignment: Alignment.centerLeft, child: Text('Which corporate culture suits you best?'), diff --git a/lib/forms/profile_category_form.dart b/lib/forms/profile_category_form.dart index 7657c87..1e40ef4 100644 --- a/lib/forms/profile_category_form.dart +++ b/lib/forms/profile_category_form.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import '../components/text_bold.dart'; import '../utils/helper.dart'; class ProfileCategoryForm extends StatefulWidget { @@ -52,13 +53,7 @@ class ProfileCategoryFormState extends State> { child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - Text( - widget.header, - style: const TextStyle( - fontSize: 18.0, - fontWeight: FontWeight.bold, - ), - ), + TextBold(text: widget.header), const SizedBox(height: 16), Text(widget.description), const SizedBox(height: 16), diff --git a/lib/pages/liked_users_page.dart b/lib/pages/liked_users_page.dart index 75491bb..188bf36 100644 --- a/lib/pages/liked_users_page.dart +++ b/lib/pages/liked_users_page.dart @@ -300,7 +300,7 @@ class LikedUsersPageState extends State { : _fetchError != null ? Center(child: Text('Error: $_fetchError')) : _likedUsersWithSwipes.isEmpty - ? const Center(child: Text('No liked users found.')) + ? const Center(child: Text('No favored profiles yet.')) : buildLikedUserList(), ], ), @@ -323,7 +323,7 @@ class LikedUsersPageState extends State { return UserTileLikes( user: user, hasMatch: hasMatch, - currentUser: _currentUser!, + currentUser: _currentUser, onUnlike: () async { Map userMap = user.data() as Map; diff --git a/lib/pages/register_page.dart b/lib/pages/register_page.dart index 39c39ac..4b4309f 100644 --- a/lib/pages/register_page.dart +++ b/lib/pages/register_page.dart @@ -21,7 +21,6 @@ class RegisterPage extends StatelessWidget { // register method Future register(BuildContext context) async { - // get auth service final auth = AuthService(); // check if passwords match @@ -56,108 +55,114 @@ class RegisterPage extends StatelessWidget { return Scaffold( backgroundColor: Theme.of(context).colorScheme.surface, body: Center( - child: ListView(children: [ - Column(mainAxisAlignment: MainAxisAlignment.center, children: [ - //logo - Icon( - Icons.people_alt, - size: 60, - color: Theme.of(context).colorScheme.primary, - ), - - const SizedBox(height: 50), - - // register message - Text( - "Let's create an account for you", - style: TextStyle( - color: Theme.of(context).colorScheme.primary, - fontSize: 16, - ), - ), - - const SizedBox(height: 25), - - // name text field - MyTextField( - hintText: "First Name", - obscureText: false, - controller: _nameController, - ), - MyTextField( - hintText: "Last Name", - obscureText: false, - controller: _lastnameController, - ), - - // email text field - MyTextField( - hintText: "E-Mail", - obscureText: false, - controller: _emailController, - ), - - const SizedBox(height: 10), - - // password text field - MyTextField( - hintText: "Password", - obscureText: true, - controller: _passwordController, - ), - - MyTextField( - hintText: "Confirm Password", - obscureText: true, - controller: _confirmPassController, - ), - - const SizedBox(height: 25), - - //login button - MyButton( - text: "Register", - onTap: () => { - if ((_nameController.text.trim().isEmpty && - _lastnameController.text.trim().isEmpty) || - _emailController.text.trim().isEmpty || - _passwordController.text.trim().isEmpty) - { - showMsg( - context, - 'Missing information', - 'Please enter your name, email and password', - ) - } - else - {register(context)} - }, - ), - - const SizedBox(height: 25), - - // register now - Row( + child: ListView( + children: [ + Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Text( - 'Already have an account? ', - style: - TextStyle(color: Theme.of(context).colorScheme.primary), + // logo + Icon( + Icons.people_alt, + size: 60, + color: Theme.of(context).colorScheme.primary, ), - GestureDetector( - onTap: onTap, - child: const Text( - 'Login now', - style: TextStyle( - fontWeight: FontWeight.bold, - ), + + const SizedBox(height: 50), + + // register message + Text( + "Let's create an account for you", + style: TextStyle( + color: Theme.of(context).colorScheme.primary, + fontSize: 16, ), ), + + const SizedBox(height: 25), + + // name text field + MyTextField( + hintText: "First Name", + obscureText: false, + controller: _nameController, + ), + MyTextField( + hintText: "Last Name", + obscureText: false, + controller: _lastnameController, + ), + + // email text field + MyTextField( + hintText: "E-Mail", + obscureText: false, + controller: _emailController, + ), + + const SizedBox(height: 10), + + // password text field + MyTextField( + hintText: "Password", + obscureText: true, + controller: _passwordController, + ), + + MyTextField( + hintText: "Confirm Password", + obscureText: true, + controller: _confirmPassController, + ), + + const SizedBox(height: 25), + + //login button + MyButton( + text: "Register", + onTap: () => { + if ((_nameController.text.trim().isEmpty && + _lastnameController.text.trim().isEmpty) || + _emailController.text.trim().isEmpty || + _passwordController.text.trim().isEmpty) + { + showMsg( + context, + 'Missing information', + 'Please enter your name, email and password', + ) + } + else + {register(context)} + }, + ), + + const SizedBox(height: 25), + + // register now + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'Already have an account? ', + style: TextStyle( + color: Theme.of(context).colorScheme.primary, + ), + ), + GestureDetector( + onTap: onTap, + child: const Text( + 'Login now', + style: TextStyle( + fontWeight: FontWeight.bold, + ), + ), + ), + ], + ) ], - ) - ]), - ]), + ), + ], + ), ), ); } diff --git a/lib/pages/registration_complete_page.dart b/lib/pages/registration_complete_page.dart index a5c6560..b95e7c6 100644 --- a/lib/pages/registration_complete_page.dart +++ b/lib/pages/registration_complete_page.dart @@ -1,3 +1,4 @@ +import 'package:cofounderella/components/text_bold.dart'; import 'package:flutter/material.dart'; import '../services/auth/auth_gate.dart'; @@ -24,9 +25,9 @@ class RegistrationCompletePage extends StatelessWidget { size: 100, ), const SizedBox(height: 20), - const Text( - 'Registration completed!', - style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold), + const TextBold( + text: 'Registration completed!', + fontSize: 24, ), const SizedBox(height: 40), const Text( diff --git a/lib/pages/user_data_page.dart b/lib/pages/user_data_page.dart index 267ed4f..0e43f20 100644 --- a/lib/pages/user_data_page.dart +++ b/lib/pages/user_data_page.dart @@ -6,6 +6,7 @@ import 'package:flutter_svg/flutter_svg.dart'; import '../components/location_dialog.dart'; import '../components/my_button.dart'; +import '../components/text_bold.dart'; import '../components/text_with_bold.dart'; import '../constants.dart'; import '../enumerations.dart'; @@ -395,18 +396,15 @@ class _UserDataPageState extends State { children: [ if (widget.isRegProcess) ...[ const SizedBox(height: 10), - const Text( - 'Please fill in the following fields to proceed with the registration process.', - style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + const TextBold( + text: + 'Please fill in the following fields to proceed with the registration process.', ), const SizedBox(height: 20), const Divider(), ], const SizedBox(height: 10), - const Text( - 'Location', - style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), + const TextBold(text: 'Location'), const SizedBox(height: 20), // Display selected main location const Text( @@ -483,10 +481,7 @@ class _UserDataPageState extends State { ], ), const SizedBox(height: 20), - const Text( - 'Age', - style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), + const TextBold(text: 'Age'), Row( children: [ const Padding(padding: EdgeInsets.symmetric(horizontal: 8)), @@ -512,13 +507,7 @@ class _UserDataPageState extends State { ], ), const SizedBox(height: 20), - const Text( - 'Gender', - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), + const TextBold(text: 'Gender'), Align( alignment: Alignment.centerLeft, child: SegmentedButton( @@ -550,10 +539,8 @@ class _UserDataPageState extends State { ), const SizedBox(height: 20), const Divider(), - Text( - 'Language: (${_selectedLanguages.length} selected)', - style: - const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + TextBold( + text: 'Language: (${_selectedLanguages.length} selected)', ), ...languagesList.map(buildSingleCheckbox), const Divider(), diff --git a/lib/pages/user_matching_page.dart b/lib/pages/user_matching_page.dart index b52402b..6eef91a 100644 --- a/lib/pages/user_matching_page.dart +++ b/lib/pages/user_matching_page.dart @@ -6,6 +6,7 @@ import 'package:swipable_stack/swipable_stack.dart'; import '../components/card_overlay.dart'; import '../components/language_list.dart'; +import '../components/text_bold.dart'; import '../components/text_with_bold.dart'; import '../constants.dart'; import '../forms/matched_screen.dart'; @@ -258,25 +259,17 @@ class UserMatchingPageState extends State { if (userProfiles.isEmpty) ...[ const CircularProgressIndicator(), const SizedBox(height: 20), - const Text( - 'Loading data, please wait...', - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18), - ), + const TextBold(text: 'Loading data, please wait...'), ] else ...[ - Text( - userProfiles.length > 1 + TextBold( + text: userProfiles.length > 1 ? 'No new profiles available yet.' : 'No profiles available at the moment.', - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18, - ), ), const SizedBox(height: 60), - const Text( - 'Please check back later, perhaps tomorrow.', + const TextBold( + text: 'Please check back later, perhaps tomorrow.', textAlign: TextAlign.center, - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18), ), ], ], @@ -393,12 +386,9 @@ class UserMatchingPageState extends State { lineWidth: 5.0, animation: true, percent: matchScore / 100, - header: Text( - "${matchScore.toStringAsFixed(2)}%", - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16.0, - ), + header: TextBold( + text: "${matchScore.toStringAsFixed(2)}%", + fontSize: 16.0, ), circularStrokeCap: CircularStrokeCap.round, progressColor: _getProgressColor(matchScore), @@ -483,16 +473,17 @@ class UserMatchingPageState extends State { children: [ const Icon(Icons.person_search, size: 64), const SizedBox(height: 20), - const Text( - 'You\'ve viewed all available profiles.', + const TextBold( + text: 'You\'ve viewed all available profiles.', textAlign: TextAlign.center, - style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold), + fontSize: 24, ), const SizedBox(height: 60), - const Text( - 'Would you like to do another run and see the remaining profiles again?', + const TextBold( + text: 'Would you like to do another run ' + 'and see the remaining profiles again?', textAlign: TextAlign.center, - style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold), + fontSize: 24, ), const SizedBox(height: 20), ElevatedButton( diff --git a/lib/pages/user_vision_page.dart b/lib/pages/user_vision_page.dart index 62346a4..e70b92e 100644 --- a/lib/pages/user_vision_page.dart +++ b/lib/pages/user_vision_page.dart @@ -1,6 +1,7 @@ import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:collection/collection.dart'; import 'package:flutter/material.dart'; +import '../components/text_bold.dart'; import '../constants.dart'; import '../enumerations.dart'; import '../forms/corporate_culture_form.dart'; @@ -155,10 +156,7 @@ class UserVisionPageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - const Text( - 'Availability and commitment', - style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), + const TextBold(text: 'Availability and commitment'), const Text( 'How much time can you devote to the startup each week?', ), @@ -175,10 +173,7 @@ class UserVisionPageState extends State { ); }), const SizedBox(height: 40), - const Text( - 'Vision and goals', - style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), + const TextBold(text: 'Vision and goals'), const Text('What is your long-term vision for a startup?'), ...VisionOption.values.map((option) { return CheckboxListTile(