From 69a6c6cca29a865e713e239fa9e7c083a65ab08a Mon Sep 17 00:00:00 2001 From: sagnik-bhattacharya Date: Sun, 14 Jul 2024 02:18:05 +0530 Subject: [PATCH] Added comments and const --- lib/common/blog.dart | 111 +++--- lib/components.dart | 503 ++++++++++++++-------------- lib/main.dart | 9 +- lib/mobile/about_mobile.dart | 106 +++--- lib/mobile/contact_mobile.dart | 12 +- lib/mobile/landing_page_mobile.dart | 90 ++--- lib/mobile/works_mobile.dart | 32 +- lib/routes.dart | 90 +++-- lib/web/about_web.dart | 102 +++--- lib/web/contact_web.dart | 12 +- lib/web/landing_page_web.dart | 110 +++--- lib/web/works_web.dart | 35 +- 12 files changed, 608 insertions(+), 604 deletions(-) diff --git a/lib/common/blog.dart b/lib/common/blog.dart index 5dae2e6..ac1cb09 100644 --- a/lib/common/blog.dart +++ b/lib/common/blog.dart @@ -1,9 +1,9 @@ import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; - import '../components.dart'; +/// The main widget for displaying the blog section. class Blog extends StatefulWidget { const Blog({Key? key}) : super(key: key); @@ -12,65 +12,36 @@ class Blog extends StatefulWidget { } class _BlogState extends State { - // List title = ["Who is Dash?", "Who is Dash 1?"]; - // List body = ["Well, we can all read about it in google", "Google it"]; - // void article() async { - // await FirebaseFirestore.instance - // .collection("articles") - // .get() - // .then((querySnapshot) { - // querySnapshot.docs.reversed.forEach((element) { - // //print(element.data()['title']); - // }); - // }); - // } - // - // void streamArticle() async { - // var logger = Logger(); - // - // await for (var snapshot - // in FirebaseFirestore.instance.collection('articles').snapshots()) { - // for (var title in snapshot.docs.reversed) { - // logger.d(title.data()['title']); - // } - // } - // } - - // @override - // void initState() { - // streamArticle(); - // //article(); - // super.initState(); - // } @override Widget build(BuildContext context) { - bool is_web = MediaQuery.of(context).size.width > 800; + // Determine if the device is a web device based on its width + bool isWeb = MediaQuery.of(context).size.width > 800; + return SafeArea( child: Scaffold( + // Extend the body behind the app bar extendBodyBehindAppBar: true, backgroundColor: Colors.white, - endDrawer: DrawersMobile(), + // Drawer for navigation + endDrawer: const DrawersMobile(), body: NestedScrollView( headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { return [ SliverAppBar( backgroundColor: Colors.white, - iconTheme: IconThemeData( - size: 35.0, - color: Colors.black, - ), + iconTheme: const IconThemeData(size: 35.0, color: Colors.black), flexibleSpace: FlexibleSpaceBar( - centerTitle: is_web ? false : true, + centerTitle: !isWeb, title: Container( decoration: BoxDecoration( color: Colors.black, borderRadius: BorderRadius.circular(3.0), ), padding: - EdgeInsets.symmetric(horizontal: is_web ? 7.0 : 4.0), + EdgeInsets.symmetric(horizontal: isWeb ? 7.0 : 4.0), child: AbelCustom( text: "Welcome to my blog", - size: is_web ? 30.0 : 24.0, + size: isWeb ? 30.0 : 24.0, color: Colors.white, fontWeight: FontWeight.bold, ), @@ -81,8 +52,8 @@ class _BlogState extends State { fit: BoxFit.cover, ), ), - expandedHeight: is_web ? 500.0 : 400.0, - ) + expandedHeight: isWeb ? 500.0 : 400.0, + ), ]; }, body: StreamBuilder( @@ -98,14 +69,13 @@ class _BlogState extends State { return BlogPost( title: documentSnapshot["title"], body: documentSnapshot["body"], - isWeb: is_web, + isWeb: isWeb, ); }, ); - } else - return Center( - child: CircularProgressIndicator(), - ); + } else { + return const Center(child: CircularProgressIndicator()); + } }, ), ), @@ -114,17 +84,18 @@ class _BlogState extends State { } } +/// A widget for displaying individual blog posts. class BlogPost extends StatefulWidget { - final title; - final body; - final isWeb; + final String title; + final String body; + final bool isWeb; - const BlogPost( - {Key? key, - @required this.title, - @required this.body, - required this.isWeb}) - : super(key: key); + const BlogPost({ + Key? key, + required this.title, + required this.body, + required this.isWeb, + }) : super(key: key); @override State createState() => _BlogPostState(); @@ -137,13 +108,14 @@ class _BlogPostState extends State { Widget build(BuildContext context) { return Padding( padding: widget.isWeb - ? EdgeInsets.only(left: 70.0, right: 70.0, top: 40.0) - : EdgeInsets.only(left: 20.0, right: 20.0, top: 30.0), + ? const EdgeInsets.only(left: 70.0, right: 70.0, top: 40.0) + : const EdgeInsets.only(left: 20.0, right: 20.0, top: 30.0), child: Container( - padding: EdgeInsets.all(10.0), + padding: const EdgeInsets.all(10.0), decoration: BoxDecoration( - border: Border.all( - style: BorderStyle.solid, width: 1.0, color: Colors.black)), + border: Border.all( + style: BorderStyle.solid, width: 1.0, color: Colors.black), + ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -151,13 +123,13 @@ class _BlogPostState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( - padding: EdgeInsets.symmetric(horizontal: 5.0), + padding: const EdgeInsets.symmetric(horizontal: 5.0), decoration: BoxDecoration( color: Colors.black, borderRadius: BorderRadius.circular(3.0), ), child: AbelCustom( - text: widget.title.toString(), + text: widget.title, size: 25.0, color: Colors.white, ), @@ -168,18 +140,17 @@ class _BlogPostState extends State { expand = !expand; }); }, - icon: Icon(Icons.arrow_drop_down_circle_outlined), + icon: const Icon(Icons.arrow_drop_down_circle_outlined), color: Colors.black, - ) + ), ], ), - SizedBox(height: 7.0), + const SizedBox(height: 7.0), Text( - widget.body.toString(), + widget.body, style: GoogleFonts.openSans(fontSize: 15.0), - maxLines: expand == true ? null : 3, - overflow: - expand == true ? TextOverflow.visible : TextOverflow.ellipsis, + maxLines: expand ? null : 3, + overflow: expand ? TextOverflow.visible : TextOverflow.ellipsis, ), ], ), diff --git a/lib/components.dart b/lib/components.dart index 620c384..2b36eca 100644 --- a/lib/components.dart +++ b/lib/components.dart @@ -5,32 +5,36 @@ import 'package:google_fonts/google_fonts.dart'; import 'package:logger/logger.dart'; import 'package:url_launcher/url_launcher.dart'; -//Variables -var logger = Logger(); +// Logger instance for debugging purposes +final Logger logger = Logger(); + +// Text editing controllers for managing input fields in forms final TextEditingController _firstNameController = TextEditingController(); final TextEditingController _lastNameController = TextEditingController(); final TextEditingController _emailController = TextEditingController(); final TextEditingController _phoneController = TextEditingController(); final TextEditingController _messageController = TextEditingController(); -//Classes and methods +// A StatefulWidget for creating navigation tabs on the web class TabsWeb extends StatefulWidget { - final title; - final route; + final String title; // Title of the tab + final String route; // Route to navigate to when the tab is clicked - const TabsWeb({Key? key, this.title, this.route}) : super(key: key); + const TabsWeb({Key? key, required this.title, required this.route}) : super(key: key); @override _TabsWebState createState() => _TabsWebState(); } +// State class for TabsWeb class _TabsWebState extends State { - bool isSelected = false; + bool isSelected = false; // Boolean to track if the tab is selected @override Widget build(BuildContext context) { return GestureDetector( onTap: () { + // Navigate to the specified route when the tab is clicked Navigator.of(context).pushNamed(widget.route); }, child: MouseRegion( @@ -38,30 +42,29 @@ class _TabsWebState extends State { setState(() { isSelected = true; }); - // print("Entered"); }, onExit: (_) { setState(() { isSelected = false; }); - // print("Exit"); }, child: AnimatedDefaultTextStyle( duration: const Duration(milliseconds: 100), curve: Curves.elasticIn, style: isSelected ? GoogleFonts.roboto( - shadows: [ - Shadow( - color: Colors.black, - offset: Offset(0, -8), - ), - ], - fontSize: 25.0, - color: Colors.transparent, - decoration: TextDecoration.underline, - decorationThickness: 2, - decorationColor: Colors.tealAccent) + shadows: [ + Shadow( + color: Colors.black, + offset: Offset(0, -8), + ), + ], + fontSize: 25.0, + color: Colors.transparent, + decoration: TextDecoration.underline, + decorationThickness: 2, + decorationColor: Colors.tealAccent, + ) : GoogleFonts.roboto(color: Colors.black, fontSize: 20.0), child: Text(widget.title), ), @@ -70,63 +73,37 @@ class _TabsWebState extends State { } } -class TabsWebList extends StatefulWidget { +// A stateless widget to create a list of navigation tabs for the web +class TabsWebList extends StatelessWidget { const TabsWebList({Key? key}) : super(key: key); - @override - State createState() => _TabsWebListState(); -} - -class _TabsWebListState extends State { @override Widget build(BuildContext context) { return Row( - children: [ - Spacer( - flex: 3, - ), - TabsWeb( - title: "Home", - route: '/', - ), + children: const [ + Spacer(flex: 3), + TabsWeb(title: "Home", route: '/'), Spacer(), - TabsWeb( - title: "Works", - route: '/works', - ), + TabsWeb(title: "Works", route: '/works'), Spacer(), - TabsWeb( - title: "Blog", - route: '/blog', - ), + TabsWeb(title: "Blog", route: '/blog'), Spacer(), - TabsWeb( - title: "About", - route: '/about', - ), + TabsWeb(title: "About", route: '/about'), + Spacer(), + TabsWeb(title: 'Contact', route: '/contact'), Spacer(), - TabsWeb( - title: 'Contact', - route: '/contact', - ), - Spacer() ], ); } } -class TabsMobile extends StatefulWidget { - final text; - final route; +// A stateless widget for creating navigation tabs on mobile devices +class TabsMobile extends StatelessWidget { + final String text; // Text to display on the tab + final String route; // Route to navigate to when the tab is clicked - const TabsMobile({Key? key, @required this.text, @required this.route}) - : super(key: key); - - @override - _TabsMobileState createState() => _TabsMobileState(); -} + const TabsMobile({Key? key, required this.text, required this.route}) : super(key: key); -class _TabsMobileState extends State { @override Widget build(BuildContext context) { return MaterialButton( @@ -138,25 +115,29 @@ class _TabsMobileState extends State { minWidth: 200.0, color: Colors.black, child: Text( - widget.text, + text, style: GoogleFonts.openSans(fontSize: 20.0, color: Colors.white), ), onPressed: () { - Navigator.of(context).pushNamed(widget.route); + // Navigate to the specified route when the tab is clicked + Navigator.of(context).pushNamed(route); }, ); } } -urlLauncher(String imgPath, String url) { +// Function to create an icon button for launching URLs +Widget urlLauncher(String imgPath, String url) { return IconButton( icon: SvgPicture.asset(imgPath, color: Colors.black, width: 35), onPressed: () async { + // Launch the specified URL await launchUrl(Uri.parse(url)); }, ); } +// A stateless widget for creating a drawer with profile information and social media links on the web class DrawersWeb extends StatelessWidget { const DrawersWeb({Key? key}) : super(key: key); @@ -167,7 +148,7 @@ class DrawersWeb extends StatelessWidget { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - CircleAvatar( + const CircleAvatar( radius: 72.0, backgroundColor: Colors.tealAccent, child: CircleAvatar( @@ -176,18 +157,15 @@ class DrawersWeb extends StatelessWidget { backgroundImage: AssetImage("assets/image.png"), ), ), - SizedBox(height: 15.0), - SansBold("Paulina Knop", 30.0), - SizedBox(height: 15.0), + const SizedBox(height: 15.0), + const SansBold("Paulina Knop", 30.0), + const SizedBox(height: 15.0), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - urlLauncher("assets/instagram.svg", - "https://www.instagram.com/tomcruise/"), - urlLauncher( - "assets/twitter.svg", "https://www.twitter.com/tomcruise"), - urlLauncher("assets/github.svg", - "https://github.com/sagnik150699/paulina_knop"), + urlLauncher("assets/instagram.svg", "https://www.instagram.com/tomcruise/"), + urlLauncher("assets/twitter.svg", "https://www.twitter.com/tomcruise"), + urlLauncher("assets/github.svg", "https://github.com/sagnik150699/paulina_knop"), ], ), ], @@ -196,6 +174,7 @@ class DrawersWeb extends StatelessWidget { } } +// A stateless widget for creating a drawer with navigation tabs and social media links on mobile devices class DrawersMobile extends StatelessWidget { const DrawersMobile({Key? key}) : super(key: key); @@ -206,47 +185,46 @@ class DrawersMobile extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ DrawerHeader( - padding: EdgeInsets.only(bottom: 20.0), + padding: const EdgeInsets.only(bottom: 20.0), child: Container( decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all(width: 2.0, color: Colors.black)), + shape: BoxShape.circle, + border: Border.all(width: 2.0, color: Colors.black), + ), child: Image.asset( 'assets/profile2-circle.png', filterQuality: FilterQuality.high, ), ), ), - TabsMobile(text: "Home", route: '/'), - SizedBox(height: 20.0), - TabsMobile(text: "Works", route: '/works'), - SizedBox(height: 20.0), - TabsMobile(text: "Blog", route: '/blog'), - SizedBox(height: 20.0), - TabsMobile(text: "About", route: '/about'), - SizedBox(height: 20.0), - TabsMobile(text: "Contact", route: '/contact'), - SizedBox(height: 40.0), + const TabsMobile(text: "Home", route: '/'), + const SizedBox(height: 20.0), + const TabsMobile(text: "Works", route: '/works'), + const SizedBox(height: 20.0), + const TabsMobile(text: "Blog", route: '/blog'), + const SizedBox(height: 20.0), + const TabsMobile(text: "About", route: '/about'), + const SizedBox(height: 20.0), + const TabsMobile(text: "Contact", route: '/contact'), + const SizedBox(height: 40.0), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - urlLauncher("assets/instagram.svg", - "https://www.instagram.com/tomcruise/"), - urlLauncher( - "assets/twitter.svg", "https://www.twitter.com/tomcruise"), - urlLauncher("assets/github.svg", - "https://github.com/sagnik150699/paulina_knop"), + urlLauncher("assets/instagram.svg", "https://www.instagram.com/tomcruise/"), + urlLauncher("assets/twitter.svg", "https://www.twitter.com/tomcruise"), + urlLauncher("assets/github.svg", "https://github.com/sagnik150699/paulina_knop"), ], - ) + ), ], ), ); } } +// A stateless widget for displaying bold text using the Sans font class SansBold extends StatelessWidget { - final text; - final size; + final String text; // Text to display + final double size; // Font size const SansBold(this.text, this.size, {Key? key}) : super(key: key); @@ -259,9 +237,10 @@ class SansBold extends StatelessWidget { } } +// A stateless widget for displaying text using the Sans font class Sans extends StatelessWidget { - final text; - final size; + final String text; // Text to display + final double size; // Font size const Sans(this.text, this.size, {Key? key}) : super(key: key); @@ -274,49 +253,52 @@ class Sans extends StatelessWidget { } } +// A stateless widget for displaying text using the Abel font with customizable properties class AbelCustom extends StatelessWidget { - final text; - final size; - final color; - final fontWeight; - - const AbelCustom( - {Key? key, - @required this.text, - @required this.size, - this.color, - this.fontWeight}) - : super(key: key); + final String text; // Text to display + final double size; // Font size + final Color? color; // Text color + final FontWeight? fontWeight; // Font weight + + const AbelCustom({ + Key? key, + required this.text, + required this.size, + this.color, + this.fontWeight, + }) : super(key: key); @override Widget build(BuildContext context) { return Text( text, style: GoogleFonts.abel( - fontSize: size, - color: color == null ? Colors.black : color, - fontWeight: fontWeight == null ? FontWeight.normal : fontWeight), + fontSize: size, + color: color ?? Colors.black, + fontWeight: fontWeight ?? FontWeight.normal, + ), ); } } +// A stateless widget for creating a form field with a label and validation class TextForm extends StatelessWidget { - final text; - final containerWidth; - final hintText; - final maxLines; - final controller; - final validator; - - const TextForm( - {Key? key, - @required this.text, - @required this.containerWidth, - @required this.hintText, - this.maxLines, - @required this.controller, - this.validator}) - : super(key: key); + final String text; // Label text + final double containerWidth; // Width of the form field container + final String hintText; // Hint text to display in the form field + final int? maxLines; // Maximum number of lines for the form field + final TextEditingController controller; // Controller for managing the form field input + final String? Function(String?)? validator; // Validator function for form field validation + + const TextForm({ + Key? key, + required this.text, + required this.containerWidth, + required this.hintText, + this.maxLines, + required this.controller, + this.validator, + }) : super(key: key); @override Widget build(BuildContext context) { @@ -324,27 +306,27 @@ class TextForm extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Sans(text, 16.0), - SizedBox(height: 5), + const SizedBox(height: 5), SizedBox( width: containerWidth, child: TextFormField( validator: validator, controller: controller, - maxLines: maxLines == null ? null : maxLines, + maxLines: maxLines, decoration: InputDecoration( - errorBorder: OutlineInputBorder( + errorBorder: const OutlineInputBorder( borderSide: BorderSide(color: Colors.red), borderRadius: BorderRadius.all(Radius.circular(10.0)), ), - focusedErrorBorder: OutlineInputBorder( + focusedErrorBorder: const OutlineInputBorder( borderSide: BorderSide(color: Colors.red), borderRadius: BorderRadius.all(Radius.circular(15.0)), ), - enabledBorder: OutlineInputBorder( + enabledBorder: const OutlineInputBorder( borderSide: BorderSide(color: Colors.teal), borderRadius: BorderRadius.all(Radius.circular(10.0)), ), - focusedBorder: OutlineInputBorder( + focusedBorder: const OutlineInputBorder( borderSide: BorderSide(color: Colors.tealAccent, width: 2.0), borderRadius: BorderRadius.all(Radius.circular(15.0)), ), @@ -358,38 +340,39 @@ class TextForm extends StatelessWidget { } } +// A stateful widget for creating an animated card with an image and optional text class AnimatedCard extends StatefulWidget { - final imagePath; - final text; - final fit; - final reverse; - final height; - final width; - - const AnimatedCard( - {Key? key, - @required this.imagePath, - this.text, - this.fit, - this.reverse, - this.height, - this.width}) - : super(key: key); + final String imagePath; // Path to the image to display on the card + final String? text; // Optional text to display on the card + final BoxFit? fit; // BoxFit for the image + final bool? reverse; // Boolean to indicate if the animation should reverse + final double? height; // Height of the image + final double? width; // Width of the image + + const AnimatedCard({ + Key? key, + required this.imagePath, + this.text, + this.fit, + this.reverse, + this.height, + this.width, + }) : super(key: key); @override _AnimatedCardState createState() => _AnimatedCardState(); } -class _AnimatedCardState extends State - with SingleTickerProviderStateMixin { +// State class for AnimatedCard +class _AnimatedCardState extends State with SingleTickerProviderStateMixin { late AnimationController _controller = AnimationController( vsync: this, duration: const Duration(seconds: 4), )..repeat(reverse: true); late Animation _animation = Tween( - begin: widget.reverse == true ? Offset(0, 0.08) : Offset.zero, - end: widget.reverse == true ? Offset.zero : Offset(0, 0.08), + begin: widget.reverse == true ? const Offset(0, 0.08) : Offset.zero, + end: widget.reverse == true ? Offset.zero : const Offset(0, 0.08), ).animate(_controller); @override @@ -406,7 +389,7 @@ class _AnimatedCardState extends State elevation: 30.0, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(15.0), - side: BorderSide(color: Colors.tealAccent), + side: const BorderSide(color: Colors.tealAccent), ), shadowColor: Colors.tealAccent, child: Padding( @@ -416,12 +399,12 @@ class _AnimatedCardState extends State children: [ Image.asset( widget.imagePath, - height: widget.height == null ? 200.0 : widget.height, - width: widget.width == null ? 200.0 : widget.width, - fit: widget.fit == null ? null : widget.fit, + height: widget.height ?? 200.0, + width: widget.width ?? 200.0, + fit: widget.fit, ), - SizedBox(height: 10.0), - widget.text == null ? SizedBox() : SansBold(widget.text, 15.0), + const SizedBox(height: 10.0), + if (widget.text != null) SansBold(widget.text!, 15.0), ], ), ), @@ -430,47 +413,53 @@ class _AnimatedCardState extends State } } +// Class for adding data to Firestore class AddDataFirestore { - CollectionReference response = - FirebaseFirestore.instance.collection('messages'); - - Future addResponse(final firstName, final lastName, final email, - final phoneNumber, final message) async { - return response.add({ - 'first name': firstName, - 'last name': lastName, - 'email': email, - 'phone number': phoneNumber, - 'message': message - }).then((value) { + final CollectionReference response = FirebaseFirestore.instance.collection('messages'); + + // Method for adding response data to Firestore + Future addResponse(String firstName, String lastName, String email, String phoneNumber, String message) async { + try { + await response.add({ + 'first name': firstName, + 'last name': lastName, + 'email': email, + 'phone number': phoneNumber, + 'message': message, + }); logger.d("Success"); return true; - }).catchError((error) { + } catch (error) { logger.d(error); return false; - }); + } } } -Future DialogError(BuildContext context, String title) { - return showDialog( - context: context, - builder: (BuildContext context) => AlertDialog( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0)), - title: SansBold(title, 20.0), - )); +// Function to display an error dialog +Future DialogError(BuildContext context, String title) { + return showDialog( + context: context, + builder: (BuildContext context) => AlertDialog( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + title: SansBold(title, 20.0), + ), + ); } +// A stateful widget for creating a contact form for the web class ContactFormWeb extends StatefulWidget { const ContactFormWeb({Key? key}) : super(key: key); @override - State createState() => _ContactFormWebState(); + _ContactFormWebState createState() => _ContactFormWebState(); } +// State class for ContactFormWeb class _ContactFormWebState extends State { - final formKey = GlobalKey(); + final GlobalKey formKey = GlobalKey(); @override Widget build(BuildContext context) { @@ -479,9 +468,9 @@ class _ContactFormWebState extends State { key: formKey, child: Column( children: [ - SizedBox(height: 30.0), - SansBold("Contact me", 40.0), - SizedBox(height: 20.0), + const SizedBox(height: 30.0), + const SansBold("Contact me", 40.0), + const SizedBox(height: 20.0), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ @@ -493,22 +482,25 @@ class _ContactFormWebState extends State { hintText: "Please type first name", controller: _firstNameController, validator: (text) { - if (text.toString().isEmpty) { + if (text!.isEmpty) { return "First name is required"; } + return null; }, ), - SizedBox(height: 15.0), + const SizedBox(height: 15.0), TextForm( - text: "Email", - containerWidth: 350.0, - hintText: "Please type email address", - controller: _emailController, - validator: (text) { - if (text.toString().isEmpty) { - return "Email is required"; - } - }), + text: "Email", + containerWidth: 350.0, + hintText: "Please type email address", + controller: _emailController, + validator: (text) { + if (text!.isEmpty) { + return "Email is required"; + } + return null; + }, + ), ], ), Column( @@ -520,18 +512,18 @@ class _ContactFormWebState extends State { hintText: "Please type last name", controller: _lastNameController, ), - SizedBox(height: 15.0), + const SizedBox(height: 15.0), TextForm( text: "Phone number", containerWidth: 350.0, hintText: "Please type phone number", controller: _phoneController, - ) + ), ], ), ], ), - SizedBox(height: 20.0), + const SizedBox(height: 20.0), TextForm( text: "Message", containerWidth: widthDevice / 1.5, @@ -539,62 +531,60 @@ class _ContactFormWebState extends State { maxLines: 10, controller: _messageController, validator: (text) { - if (text.toString().isEmpty) { + if (text!.isEmpty) { return "Message is required"; } + return null; }, ), - SizedBox(height: 20.0), + const SizedBox(height: 20.0), MaterialButton( onPressed: () async { logger.d(_firstNameController.text); - final addData = new AddDataFirestore(); + final addData = AddDataFirestore(); if (formKey.currentState!.validate()) { if (await addData.addResponse( - _firstNameController.text, - _lastNameController.text, - _emailController.text, - _phoneController.text, - _messageController.text)) { + _firstNameController.text, + _lastNameController.text, + _emailController.text, + _phoneController.text, + _messageController.text, + )) { formKey.currentState!.reset(); DialogError(context, "Message sent successfully"); } else { - DialogError(context, "Message failed to sent"); + DialogError(context, "Message failed to send"); } } }, elevation: 20.0, shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0)), + borderRadius: BorderRadius.circular(10.0), + ), height: 60.0, minWidth: 200.0, color: Colors.tealAccent, - child: SansBold("Submit", 20.0), + child: const SansBold("Submit", 20.0), ), - SizedBox(height: 10.0) + const SizedBox(height: 10.0), ], ), ); } } +// A stateful widget for creating a contact form for mobile devices class ContactFormMobile extends StatefulWidget { const ContactFormMobile({Key? key}) : super(key: key); @override - State createState() => _ContactFormMobileState(); + _ContactFormMobileState createState() => _ContactFormMobileState(); } +// State class for ContactFormMobile class _ContactFormMobileState extends State { - final formKey = GlobalKey(); - - // final TextEditingController _firstNameController = TextEditingController(); - // final TextEditingController _lastNameController = TextEditingController(); - // final TextEditingController _emailController = TextEditingController(); - // final TextEditingController _phoneController = TextEditingController(); - // final TextEditingController _messageController = TextEditingController(); - // final formKey = GlobalKey(); - // var logger = Logger(); + final GlobalKey formKey = GlobalKey(); + @override Widget build(BuildContext context) { var widthDevice = MediaQuery.of(context).size.width; @@ -605,16 +595,17 @@ class _ContactFormMobileState extends State { spacing: 20.0, alignment: WrapAlignment.center, children: [ - SansBold("Contact me", 35.0), + const SansBold("Contact me", 35.0), TextForm( text: "First name", containerWidth: widthDevice / 1.4, hintText: "Please type first name", controller: _firstNameController, validator: (text) { - if (text.toString().isEmpty) { + if (text!.isEmpty) { return "First name is required"; } + return null; }, ), TextForm( @@ -630,15 +621,17 @@ class _ContactFormMobileState extends State { controller: _phoneController, ), TextForm( - text: "Email", - containerWidth: widthDevice / 1.4, - hintText: "Please type email address", - controller: _emailController, - validator: (text) { - if (text.toString().isEmpty) { - return "Email is required"; - } - }), + text: "Email", + containerWidth: widthDevice / 1.4, + hintText: "Please type email address", + controller: _emailController, + validator: (text) { + if (text!.isEmpty) { + return "Email is required"; + } + return null; + }, + ), TextForm( text: "Message", containerWidth: widthDevice / 1.4, @@ -646,26 +639,28 @@ class _ContactFormMobileState extends State { maxLines: 10, controller: _messageController, validator: (text) { - if (text.toString().isEmpty) { + if (text!.isEmpty) { return "Message is required"; } + return null; }, ), MaterialButton( onPressed: () async { logger.d(_firstNameController.text); - final addData = new AddDataFirestore(); + final addData = AddDataFirestore(); if (formKey.currentState!.validate()) { if (await addData.addResponse( - _firstNameController.text, - _lastNameController.text, - _emailController.text, - _phoneController.text, - _messageController.text)) { + _firstNameController.text, + _lastNameController.text, + _emailController.text, + _phoneController.text, + _messageController.text, + )) { formKey.currentState!.reset(); DialogError(context, "Message sent successfully"); } else { - DialogError(context, "Message failed to sent"); + DialogError(context, "Message failed to send"); } } }, @@ -676,24 +671,26 @@ class _ContactFormMobileState extends State { height: 60.0, minWidth: widthDevice / 2.2, color: Colors.tealAccent, - child: SansBold("Submit", 20.0), - ) + child: const SansBold("Submit", 20.0), + ), ], ), ); } } -tealContainer(String text) { +// Function to create a container with teal border and text +Widget tealContainer(String text) { return Container( decoration: BoxDecoration( - border: Border.all( - color: Colors.tealAccent, - style: BorderStyle.solid, - width: 2.0, - ), - borderRadius: BorderRadius.circular(5.0)), - padding: EdgeInsets.all(7.0), + border: Border.all( + color: Colors.tealAccent, + style: BorderStyle.solid, + width: 2.0, + ), + borderRadius: BorderRadius.circular(5.0), + ), + padding: const EdgeInsets.all(7.0), child: Text( text, style: GoogleFonts.openSans(fontSize: 15.0), diff --git a/lib/main.dart b/lib/main.dart index 12eb1d3..03601c8 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -2,18 +2,20 @@ import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/material.dart'; import 'package:paulina_knop/routes.dart'; import 'package:url_strategy/url_strategy.dart'; - import 'firebase_options.dart'; -void main() async { +/// The main entry point of the application. +Future main() async { WidgetsFlutterBinding.ensureInitialized(); setPathUrlStrategy(); + // Initialize Firebase with the default platform options await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); runApp(const MyApp()); } +/// The root widget of the application. class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @@ -21,7 +23,8 @@ class MyApp extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, - onGenerateRoute: (settings) => Routes.generateRoute(settings), + // Generate routes for navigation + onGenerateRoute: Routes.generateRoute, initialRoute: '/', ); } diff --git a/lib/mobile/about_mobile.dart b/lib/mobile/about_mobile.dart index bead7cf..136f2c5 100644 --- a/lib/mobile/about_mobile.dart +++ b/lib/mobile/about_mobile.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import '../components.dart'; +/// The main widget for displaying the about section on mobile devices. class AboutMobile extends StatefulWidget { const AboutMobile({Key? key}) : super(key: key); @@ -14,19 +15,21 @@ class _AboutMobileState extends State { Widget build(BuildContext context) { return SafeArea( child: Scaffold( + // Extend the body behind the app bar extendBodyBehindAppBar: true, backgroundColor: Colors.white, appBar: AppBar( backgroundColor: Colors.transparent, elevation: 0.0, - iconTheme: IconThemeData(size: 35.0, color: Colors.black), + iconTheme: const IconThemeData(size: 35.0, color: Colors.black), ), - endDrawer: DrawersMobile(), + // Drawer for navigation + endDrawer: const DrawersMobile(), body: Padding( padding: const EdgeInsets.symmetric(horizontal: 20.0), child: ListView( children: [ - //Introduction, first section + // Introduction section CircleAvatar( radius: 117.0, backgroundColor: Colors.tealAccent, @@ -43,24 +46,24 @@ class _AboutMobileState extends State { ), ), ), - SizedBox(height: 20.0), + const SizedBox(height: 20.0), Padding( - padding: EdgeInsets.symmetric(horizontal: 20.0), + padding: const EdgeInsets.symmetric(horizontal: 20.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ - SansBold("About me", 35.0), - SizedBox(height: 10.0), - Sans( - "Hello! I'm Paulina Knop I specialize in flutter development", - 15.0), - Sans( - "I strive to ensure astounding performance with state of ", - 15.0), - Sans("the art security for Android, Ios, Web, Mac,Linux", - 15.0), - SizedBox(height: 15.0), + const SansBold("About me", 35.0), + const SizedBox(height: 10.0), + const Sans( + "Hello! I'm Paulina Knop. I specialize in Flutter development", + 15.0, + ), + const Sans( + "I strive to ensure astounding performance with state of the art security for Android, iOS, Web, Mac, and Linux.", + 15.0, + ), + const SizedBox(height: 15.0), Wrap( spacing: 7.0, runSpacing: 7.0, @@ -70,82 +73,69 @@ class _AboutMobileState extends State { tealContainer("Android"), tealContainer("Windows"), ], - ) + ), ], ), ), - SizedBox(height: 40.0), + const SizedBox(height: 40.0), - //Web development, second section + // Web development section Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - AnimatedCard( + const AnimatedCard( imagePath: "assets/webL.png", width: 200.0, ), - SizedBox( - height: 30.0, + const SizedBox(height: 30.0), + const SansBold("Web development", 20.0), + const SizedBox(height: 10.0), + const Sans( + "I'm here to build your presence online with state-of-the-art web apps.", + 15.0, ), - SansBold("Web development", 20.0), - SizedBox(height: 10.0), ], ), - Sans( - "I'm here to build your presence online with state of the art web apps", - 15.0), - //App development, third section + // App development section Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - SizedBox( - height: 20.0, - ), - AnimatedCard( + const SizedBox(height: 20.0), + const AnimatedCard( imagePath: "assets/app.png", width: 200.0, reverse: true, ), - SizedBox( - height: 30.0, - ), - SansBold("App development.", 20.0), - SizedBox( - height: 10.0, + const SizedBox(height: 30.0), + const SansBold("App development", 20.0), + const SizedBox(height: 10.0), + const Sans( + "Do you need a high-performance, responsive, and beautiful app? Don't worry, I've got you covered.", + 15.0, ), ], ), - Sans( - "Do you need a high-performance, responsive and beautiful app? Don't worry, I've got you covered.", - 15.0), - //Back end development, forth section + // Back-end development section Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - SizedBox( - height: 20.0, - ), - AnimatedCard( + const SizedBox(height: 20.0), + const AnimatedCard( imagePath: "assets/firebase.png", width: 200.0, ), - SizedBox( - height: 30.0, - ), - SansBold("Back-end development.", 20.0), - SizedBox( - height: 10.0, + const SizedBox(height: 30.0), + const SansBold("Back-end development", 20.0), + const SizedBox(height: 10.0), + const Sans( + "Do you want your back-end to be highly scalable and secure? Let's have a conversation on how I can help you with that.", + 15.0, ), ], ), - Sans( - "Do you want your back-end to be highly scalable and secure? Let's have a conversation on how I can help you with that.", - 15.0), - SizedBox( - height: 20.0, - ) + const SizedBox(height: 20.0), ], ), ), diff --git a/lib/mobile/contact_mobile.dart b/lib/mobile/contact_mobile.dart index d86ba4e..8a99a19 100644 --- a/lib/mobile/contact_mobile.dart +++ b/lib/mobile/contact_mobile.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; - import '../components.dart'; +/// The main widget for displaying the contact section on mobile devices. class ContactMobile extends StatefulWidget { const ContactMobile({Key? key}) : super(key: key); @@ -14,26 +14,28 @@ class _ContactMobileState extends State { Widget build(BuildContext context) { return SafeArea( child: Scaffold( + // Extend the body behind the app bar extendBodyBehindAppBar: true, backgroundColor: Colors.white, - endDrawer: DrawersMobile(), + // Drawer for navigation + endDrawer: const DrawersMobile(), body: NestedScrollView( headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { return [ SliverAppBar( expandedHeight: 400.0, backgroundColor: Colors.white, - iconTheme: IconThemeData(size: 35.0, color: Colors.black), + iconTheme: const IconThemeData(size: 35.0, color: Colors.black), flexibleSpace: FlexibleSpaceBar( background: Image.asset( "assets/contact_image.jpg", fit: BoxFit.cover, ), ), - ) + ), ]; }, - body: SingleChildScrollView( + body: const SingleChildScrollView( padding: EdgeInsets.symmetric(vertical: 25.0), child: ContactFormMobile(), ), diff --git a/lib/mobile/landing_page_mobile.dart b/lib/mobile/landing_page_mobile.dart index 7872676..ee30cd5 100644 --- a/lib/mobile/landing_page_mobile.dart +++ b/lib/mobile/landing_page_mobile.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:paulina_knop/components.dart'; +/// The main widget for displaying the landing page on mobile devices. class LandingPageMobile extends StatefulWidget { const LandingPageMobile({Key? key}) : super(key: key); @@ -13,18 +14,20 @@ class _LandingPageMobileState extends State { Widget build(BuildContext context) { return SafeArea( child: Scaffold( + // Extend the body behind the app bar extendBodyBehindAppBar: true, backgroundColor: Colors.white, appBar: AppBar( backgroundColor: Colors.transparent, elevation: 0.0, - iconTheme: IconThemeData(size: 35.0, color: Colors.black), + iconTheme: const IconThemeData(size: 35.0, color: Colors.black), ), - endDrawer: DrawersMobile(), + // Drawer for navigation + endDrawer: const DrawersMobile(), body: ListView( children: [ - //Intro, First section - CircleAvatar( + // Introduction section + const CircleAvatar( radius: 117.0, backgroundColor: Colors.tealAccent, child: CircleAvatar( @@ -42,72 +45,75 @@ class _LandingPageMobileState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox(height: 25.0), + const SizedBox(height: 25.0), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - decoration: BoxDecoration( - color: Colors.tealAccent, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(20.0), - topRight: Radius.circular(20.0), - bottomRight: Radius.circular(20.0))), - padding: EdgeInsets.symmetric( - vertical: 10.0, horizontal: 20.0), - child: SansBold("Hello I'm", 15.0), + decoration: const BoxDecoration( + color: Colors.tealAccent, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(20.0), + topRight: Radius.circular(20.0), + bottomRight: Radius.circular(20.0), + ), + ), + padding: const EdgeInsets.symmetric( + vertical: 10.0, + horizontal: 20.0, + ), + child: const SansBold("Hello I'm", 15.0), ), - SansBold("Paulina Knop", 40.0), - Sans("Flutter developer", 20.0), + const SansBold("Paulina Knop", 40.0), + const Sans("Flutter developer", 20.0), ], ), - SizedBox(height: 15.0), + const SizedBox(height: 15.0), Row( mainAxisAlignment: MainAxisAlignment.start, children: [ Wrap( direction: Axis.vertical, spacing: 3.0, - children: [ + children: const [ Icon(Icons.email), Icon(Icons.call), Icon(Icons.location_pin), ], ), - SizedBox(width: 40.0), + const SizedBox(width: 40.0), Wrap( direction: Axis.vertical, spacing: 9.0, - children: [ + children: const [ Sans("paulinaknop@gmail.com", 15.0), Sans("+48 942 564 985", 15.0), Sans("13/3, Szczecin, Poland", 15.0), ], - ) + ), ], - ) + ), ], ), ), - SizedBox(height: 90.0), - //About me, Second section - + const SizedBox(height: 90.0), + // About me section Padding( - padding: EdgeInsets.symmetric(horizontal: 20.0), + padding: const EdgeInsets.symmetric(horizontal: 20.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ - SansBold("About me", 35.0), - Sans( - "Hello! I'm Paulina Knop I specialize in flutter development", - 15.0), - Sans( - "I strive to ensure astounding performance with state of ", - 15.0), - Sans("the art security for Android, Ios, Web, Mac,Linux", - 15.0), - SizedBox(height: 10.0), + const SansBold("About me", 35.0), + const Sans( + "Hello! I'm Paulina Knop I specialize in flutter development", + 15.0, + ), + const Sans( + "I strive to ensure astounding performance with state of the art security for Android, iOS, Web, Mac, Linux", + 15.0, + ), + const SizedBox(height: 10.0), Wrap( spacing: 7.0, runSpacing: 7.0, @@ -117,15 +123,15 @@ class _LandingPageMobileState extends State { tealContainer("Android"), tealContainer("Windows"), ], - ) + ), ], ), ), - SizedBox(height: 60.0), - //Third section What I do? + const SizedBox(height: 60.0), + // What I do section Column( crossAxisAlignment: CrossAxisAlignment.center, - children: [ + children: const [ SansBold("What I do?", 35.0), AnimatedCard( imagePath: "assets/webL.png", @@ -147,11 +153,11 @@ class _LandingPageMobileState extends State { width: 300.0, ), SizedBox(height: 60.0), - //Contact Forth section + // Contact section ContactFormMobile(), SizedBox(height: 20.0), ], - ) + ), ], ), ), diff --git a/lib/mobile/works_mobile.dart b/lib/mobile/works_mobile.dart index 41070dc..2ddd4d6 100644 --- a/lib/mobile/works_mobile.dart +++ b/lib/mobile/works_mobile.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import '../components.dart'; +/// The main widget for displaying the works section on mobile devices. class WorksMobile extends StatefulWidget { const WorksMobile({Key? key}) : super(key: key); @@ -14,23 +15,25 @@ class _WorksMobileState extends State { Widget build(BuildContext context) { return SafeArea( child: Scaffold( + // Extend the body behind the app bar extendBodyBehindAppBar: true, backgroundColor: Colors.white, - endDrawer: DrawersMobile(), + // Drawer for navigation + endDrawer: const DrawersMobile(), body: NestedScrollView( headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { return [ SliverAppBar( expandedHeight: 400.0, backgroundColor: Colors.white, - iconTheme: IconThemeData(size: 35.0, color: Colors.black), + iconTheme: const IconThemeData(size: 35.0, color: Colors.black), flexibleSpace: FlexibleSpaceBar( background: Image.asset( "assets/works.jpg", fit: BoxFit.cover, ), ), - ) + ), ]; }, body: ListView( @@ -38,23 +41,24 @@ class _WorksMobileState extends State { Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - SizedBox(height: 20.0), - SansBold("Works", 35.0), - SizedBox(height: 20.0), - AnimatedCard( + const SizedBox(height: 20.0), + const SansBold("Works", 35.0), + const SizedBox(height: 20.0), + const AnimatedCard( imagePath: "assets/portfolio_screenshot.PNG", fit: BoxFit.contain, height: 150.0, width: 300.0, ), - SizedBox(height: 30.0), - SansBold("Portfolio", 20.0), - SizedBox(height: 10.0), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 20.0), + const SizedBox(height: 30.0), + const SansBold("Portfolio", 20.0), + const SizedBox(height: 10.0), + const Padding( + padding: EdgeInsets.symmetric(horizontal: 20.0), child: Sans( - "Deployed on Android, IOS and Web, the portfolio project was truly an achievement. I used Flutter to develop the beautiful and responsive UI and Firebase for the back-end.", - 15.0), + "Deployed on Android, IOS and Web, the portfolio project was truly an achievement. I used Flutter to develop the beautiful and responsive UI and Firebase for the back-end.", + 15.0, + ), ), ], ), diff --git a/lib/routes.dart b/lib/routes.dart index b260ac7..f992854 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -10,57 +10,79 @@ import 'package:paulina_knop/web/works_web.dart'; import 'mobile/landing_page_mobile.dart'; import 'web/contact_web.dart'; +/// The class responsible for generating routes based on the provided route settings. class Routes { static Route generateRoute(RouteSettings settings) { switch (settings.name) { case '/': return MaterialPageRoute( settings: settings, - builder: (_) => LayoutBuilder(builder: (context, constraints) { - if (constraints.maxWidth > 800) { - return LandingPageWeb(); - } else - return LandingPageMobile(); - }), + builder: (_) => LayoutBuilder( + builder: (context, constraints) { + if (constraints.maxWidth > 800) { + return const LandingPageWeb(); + } else { + return const LandingPageMobile(); + } + }, + ), ); case '/contact': return MaterialPageRoute( - builder: (_) => LayoutBuilder(builder: (context, constraints) { - if (constraints.maxWidth > 800) { - return ContactWeb(); - } else - return ContactMobile(); - }), - settings: settings); + settings: settings, + builder: (_) => LayoutBuilder( + builder: (context, constraints) { + if (constraints.maxWidth > 800) { + return const ContactWeb(); + } else { + return const ContactMobile(); + } + }, + ), + ); case '/about': return MaterialPageRoute( - builder: (_) => LayoutBuilder(builder: (context, constraints) { - if (constraints.maxWidth > 800) { - return AboutWeb(); - } else - return AboutMobile(); - }), - settings: settings); + settings: settings, + builder: (_) => LayoutBuilder( + builder: (context, constraints) { + if (constraints.maxWidth > 800) { + return const AboutWeb(); + } else { + return const AboutMobile(); + } + }, + ), + ); case '/blog': - return MaterialPageRoute(builder: (_) => Blog(), settings: settings); + return MaterialPageRoute( + settings: settings, + builder: (_) => const Blog(), + ); case '/works': return MaterialPageRoute( - builder: (_) => LayoutBuilder(builder: (context, constraints) { - if (constraints.maxWidth > 800) { - return WorksWeb(); - } else - return WorksMobile(); - }), - settings: settings); + settings: settings, + builder: (_) => LayoutBuilder( + builder: (context, constraints) { + if (constraints.maxWidth > 800) { + return const WorksWeb(); + } else { + return const WorksMobile(); + } + }, + ), + ); default: return MaterialPageRoute( settings: settings, - builder: (_) => LayoutBuilder(builder: (context, constraints) { - if (constraints.maxWidth > 800) { - return LandingPageWeb(); - } else - return LandingPageMobile(); - }), + builder: (_) => LayoutBuilder( + builder: (context, constraints) { + if (constraints.maxWidth > 800) { + return const LandingPageWeb(); + } else { + return const LandingPageMobile(); + } + }, + ), ); } } diff --git a/lib/web/about_web.dart b/lib/web/about_web.dart index be69be0..6f8c9e6 100644 --- a/lib/web/about_web.dart +++ b/lib/web/about_web.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:paulina_knop/components.dart'; +/// The main widget for displaying the about section on web devices. class AboutWeb extends StatefulWidget { const AboutWeb({Key? key}) : super(key: key); @@ -11,22 +12,25 @@ class AboutWeb extends StatefulWidget { class _AboutWebState extends State { @override Widget build(BuildContext context) { + // Get the width of the device var widthDevice = MediaQuery.of(context).size.width; + return Scaffold( - drawer: DrawersWeb(), + // Drawer for navigation + drawer: const DrawersWeb(), backgroundColor: Colors.white, appBar: AppBar( backgroundColor: Colors.white, elevation: 0.0, - iconTheme: IconThemeData( + iconTheme: const IconThemeData( size: 25.0, color: Colors.black, ), - title: TabsWebList(), + title: const TabsWebList(), ), body: ListView( children: [ - //About me, first section + // About me section SizedBox( height: 500.0, child: Row( @@ -37,34 +41,27 @@ class _AboutWebState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ - SansBold("About me", 40.0), - SizedBox(height: 15.0), - Sans( - "Hello! I'm Paulina Knop I specialize in flutter development.", - 15.0), - Sans( - "I strive to ensure astounding performance with state of", - 15.0), - Sans( - "the art security for Android, Ios, Web, Mac, Linux and Windows", - 15.0), - SizedBox(height: 10.0), + const SansBold("About me", 40.0), + const SizedBox(height: 15.0), + const Sans( + "Hello! I'm Paulina Knop. I specialize in flutter development.", + 15.0, + ), + const Sans( + "I strive to ensure astounding performance with state of the art security for Android, iOS, Web, Mac, Linux and Windows.", + 15.0, + ), + const SizedBox(height: 10.0), Row( children: [ tealContainer("Flutter"), - SizedBox( - width: 7.0, - ), + const SizedBox(width: 7.0), tealContainer("Firebase"), - SizedBox( - width: 7.0, - ), + const SizedBox(width: 7.0), tealContainer("Android"), - SizedBox( - width: 7.0, - ), - tealContainer("IOS"), - SizedBox(width: 7.0), + const SizedBox(width: 7.0), + tealContainer("iOS"), + const SizedBox(width: 7.0), tealContainer("Windows"), ], ), @@ -89,12 +86,13 @@ class _AboutWebState extends State { ], ), ), + const SizedBox(height: 20.0), - //Web development, second section + // Web development section Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - AnimatedCard( + const AnimatedCard( imagePath: "assets/webL.png", height: 250.0, width: 250.0, @@ -102,49 +100,52 @@ class _AboutWebState extends State { SizedBox( width: widthDevice / 3, child: Column( - children: [ + children: const [ SansBold("Web development", 30.0), SizedBox(height: 15.0), Sans( - "I'm here to build your presence online with state of the art web apps.", - 15.0) + "I'm here to build your presence online with state of the art web apps.", + 15.0, + ), ], ), - ) + ), ], ), - SizedBox(height: 20.0), - //App development, third section + const SizedBox(height: 20.0), + + // App development section Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ SizedBox( width: widthDevice / 3, child: Column( - children: [ + children: const [ SansBold("App development", 30.0), SizedBox(height: 15.0), Sans( - "Do you need a high-performance, responsive and beautiful app? Don't worry, I've got you covered.", - 15.0), + "Do you need a high-performance, responsive and beautiful app? Don't worry, I've got you covered.", + 15.0, + ), ], ), ), - AnimatedCard( + const AnimatedCard( imagePath: "assets/app.png", height: 250.0, width: 250.0, reverse: true, - ) + ), ], ), - SizedBox(height: 20.0), + const SizedBox(height: 20.0), - //Back-end development, second section + // Back-end development section Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - AnimatedCard( + const AnimatedCard( imagePath: "assets/firebase.png", height: 250.0, width: 250.0, @@ -152,20 +153,19 @@ class _AboutWebState extends State { SizedBox( width: widthDevice / 3, child: Column( - children: [ + children: const [ SansBold("Back-end development", 30.0), - SizedBox( - height: 15.0, - ), + SizedBox(height: 15.0), Sans( - "Do you want your back-end to be highly scalable and secure? Let's have a conversation on how I can help you with that.", - 15.0), + "Do you want your back-end to be highly scalable and secure? Let's have a conversation on how I can help you with that.", + 15.0, + ), ], ), - ) + ), ], ), - SizedBox(height: 40.0), + const SizedBox(height: 40.0), ], ), ); diff --git a/lib/web/contact_web.dart b/lib/web/contact_web.dart index 6fc5ae3..ba475d6 100644 --- a/lib/web/contact_web.dart +++ b/lib/web/contact_web.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:paulina_knop/components.dart'; +/// The main widget for displaying the contact section on web devices. class ContactWeb extends StatefulWidget { const ContactWeb({Key? key}) : super(key: key); @@ -12,7 +13,8 @@ class _ContactWebState extends State { @override Widget build(BuildContext context) { return Scaffold( - drawer: DrawersWeb(), + // Drawer for navigation + drawer: const DrawersWeb(), backgroundColor: Colors.white, body: NestedScrollView( headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { @@ -20,7 +22,7 @@ class _ContactWebState extends State { SliverAppBar( expandedHeight: 500.0, backgroundColor: Colors.white, - iconTheme: IconThemeData(size: 25.0, color: Colors.black), + iconTheme: const IconThemeData(size: 25.0, color: Colors.black), flexibleSpace: FlexibleSpaceBar( background: Image.asset( "assets/contact_image.jpg", @@ -28,11 +30,11 @@ class _ContactWebState extends State { filterQuality: FilterQuality.high, ), ), - title: TabsWebList(), - ) + title: const TabsWebList(), + ), ]; }, - body: SingleChildScrollView( + body: const SingleChildScrollView( child: ContactFormWeb(), ), ), diff --git a/lib/web/landing_page_web.dart b/lib/web/landing_page_web.dart index 4a24e17..df049d4 100644 --- a/lib/web/landing_page_web.dart +++ b/lib/web/landing_page_web.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:paulina_knop/components.dart'; +/// The main widget for displaying the landing page on web devices. class LandingPageWeb extends StatefulWidget { const LandingPageWeb({Key? key}) : super(key: key); @@ -11,23 +12,26 @@ class LandingPageWeb extends StatefulWidget { class _LandingPageWebState extends State { @override Widget build(BuildContext context) { + // Get the height and width of the device var heightDevice = MediaQuery.of(context).size.height; var widthDevice = MediaQuery.of(context).size.width; + return Scaffold( - drawer: DrawersWeb(), + // Drawer for navigation + drawer: const DrawersWeb(), backgroundColor: Colors.white, appBar: AppBar( backgroundColor: Colors.white, elevation: 0.0, - iconTheme: IconThemeData( + iconTheme: const IconThemeData( size: 25.0, color: Colors.black, ), - title: TabsWebList(), + title: const TabsWebList(), ), body: ListView( children: [ - //First section + // First section: Introduction Container( height: heightDevice - 56, child: Row( @@ -38,39 +42,42 @@ class _LandingPageWebState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - decoration: BoxDecoration( - color: Colors.tealAccent, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(20.0), - topRight: Radius.circular(20.0), - bottomRight: Radius.circular(20.0), - )), - padding: EdgeInsets.symmetric( - vertical: 10.0, horizontal: 20.0), - child: SansBold("Hello I'm", 15.0), + decoration: const BoxDecoration( + color: Colors.tealAccent, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(20.0), + topRight: Radius.circular(20.0), + bottomRight: Radius.circular(20.0), + ), + ), + padding: const EdgeInsets.symmetric( + vertical: 10.0, + horizontal: 20.0, + ), + child: const SansBold("Hello I'm", 15.0), ), - SizedBox(height: 15.0), - SansBold("Paulina Knop", 55.0), - Sans("Flutter developer", 30.0), - SizedBox(height: 15.0), + const SizedBox(height: 15.0), + const SansBold("Paulina Knop", 55.0), + const Sans("Flutter developer", 30.0), + const SizedBox(height: 15.0), Row( - children: [ + children: const [ Icon(Icons.email), SizedBox(width: 20.0), Sans("paulinaknop@gmail.com", 15.0), ], ), - SizedBox(height: 10.0), + const SizedBox(height: 10.0), Row( - children: [ + children: const [ Icon(Icons.call), SizedBox(width: 20.0), Sans("+48 942 564 985", 15.0), ], ), - SizedBox(height: 10.0), + const SizedBox(height: 10.0), Row( - children: [ + children: const [ Icon(Icons.location_pin), SizedBox(width: 20.0), Sans("13/3, Szczecin, Poland", 15.0), @@ -78,7 +85,7 @@ class _LandingPageWebState extends State { ), ], ), - CircleAvatar( + const CircleAvatar( radius: 147.0, backgroundColor: Colors.tealAccent, child: CircleAvatar( @@ -94,7 +101,7 @@ class _LandingPageWebState extends State { ], ), ), - //Second section + // Second section: About me Container( height: heightDevice / 1.5, child: Row( @@ -106,46 +113,45 @@ class _LandingPageWebState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ - SansBold("About me", 40.0), - SizedBox(height: 15.0), - Sans( - "Hello! I'm Paulina Knop I specialize in flutter development.", - 15.0), - Sans( - "I strive to ensure astounding performance with state of ", - 15.0), - Sans( - "the art security for Android, Ios, Web, Mac, Linux and Windows", - 15.0), - SizedBox(height: 10.0), + const SansBold("About me", 40.0), + const SizedBox(height: 15.0), + const Sans( + "Hello! I'm Paulina Knop. I specialize in flutter development.", + 15.0, + ), + const Sans( + "I strive to ensure astounding performance with state of the art security for Android, iOS, Web, Mac, Linux, and Windows.", + 15.0, + ), + const SizedBox(height: 10.0), Row( children: [ tealContainer("Flutter"), - SizedBox(width: 7.0), + const SizedBox(width: 7.0), tealContainer("Firebase"), - SizedBox(width: 7.0), + const SizedBox(width: 7.0), tealContainer("Android"), - SizedBox(width: 7.0), - tealContainer("IOS"), - SizedBox(width: 7.0), + const SizedBox(width: 7.0), + tealContainer("iOS"), + const SizedBox(width: 7.0), tealContainer("Windows"), ], - ) + ), ], ), ], ), ), - //Third section + // Third section: What I do Container( height: heightDevice / 1.3, child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - SansBold("What I do?", 40.0), + const SansBold("What I do?", 40.0), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ + children: const [ AnimatedCard( imagePath: "assets/webL.png", text: "Web development", @@ -161,16 +167,14 @@ class _LandingPageWebState extends State { text: "Back-end development", ), ], - ) + ), ], ), ), - //Forth section - SizedBox( - height: 15.0, - ), - ContactFormWeb(), - SizedBox(height: 20.0), + // Fourth section: Contact form + const SizedBox(height: 15.0), + const ContactFormWeb(), + const SizedBox(height: 20.0), ], ), ); diff --git a/lib/web/works_web.dart b/lib/web/works_web.dart index bbfe188..4cea29a 100644 --- a/lib/web/works_web.dart +++ b/lib/web/works_web.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:paulina_knop/components.dart'; +/// The main widget for displaying the works section on the web. class WorksWeb extends StatefulWidget { const WorksWeb({Key? key}) : super(key: key); @@ -11,9 +12,12 @@ class WorksWeb extends StatefulWidget { class _WorksWebState extends State { @override Widget build(BuildContext context) { + // Get the width of the device var widthDevice = MediaQuery.of(context).size.width; + return Scaffold( - drawer: DrawersWeb(), + // Drawer for navigation + drawer: const DrawersWeb(), backgroundColor: Colors.white, body: NestedScrollView( headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { @@ -21,7 +25,7 @@ class _WorksWebState extends State { SliverAppBar( expandedHeight: 500.0, backgroundColor: Colors.white, - iconTheme: IconThemeData(size: 25.0, color: Colors.black), + iconTheme: const IconThemeData(size: 25.0, color: Colors.black), flexibleSpace: FlexibleSpaceBar( background: Image.asset( "assets/works.jpg", @@ -29,20 +33,20 @@ class _WorksWebState extends State { filterQuality: FilterQuality.high, ), ), - title: TabsWebList(), - ) + title: const TabsWebList(), + ), ]; }, body: ListView( children: [ Column( children: [ - SizedBox(height: 30.0), - SansBold("Works", 40.0), + const SizedBox(height: 30.0), + const SansBold("Works", 40.0), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - AnimatedCard( + const AnimatedCard( imagePath: "assets/portfolio_screenshot.PNG", height: 200.0, width: 300.0, @@ -50,21 +54,20 @@ class _WorksWebState extends State { SizedBox( width: widthDevice / 3, child: Column( - children: [ + children: const [ SansBold("Portfolio", 30.0), - SizedBox( - height: 15.0, - ), + SizedBox(height: 15.0), Sans( - "Deployed on Android, IOS and Web, the portfolio project was truly an achievement. I used Flutter to develop the beautiful and responsive UI and Firebase for the back-end.", - 15.0) + "Deployed on Android, IOS and Web, the portfolio project was truly an achievement. I used Flutter to develop the beautiful and responsive UI and Firebase for the back-end.", + 15.0, + ), ], ), - ) + ), ], - ) + ), ], - ) + ), ], ), ),