diff --git a/README.md b/README.md index 9152445..875da54 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,4 @@ -# Flutter Course Code - -## Getting Started - -This project is a starting point for a Flutter application. - -A few resources to get you started if this is your first Flutter project: - -- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) -- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) - -For help getting started with Flutter, view our -[online documentation](https://flutter.dev/docs), which offers tutorials, -samples, guidance on mobile development, and a full API reference. +# screenshots + +
+ diff --git a/android/app/build.gradle b/android/app/build.gradle index 617083c..b578ed0 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -43,7 +43,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.example.contacts_01" + applicationId "com.example.car_renting" minSdkVersion 16 targetSdkVersion 30 versionCode flutterVersionCode.toInteger() diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml index 47d7ea9..48c0277 100644 --- a/android/app/src/debug/AndroidManifest.xml +++ b/android/app/src/debug/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.example.car_renting"> diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 609e8ad..3432fa4 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,7 +1,7 @@ + package="com.example.car_renting"> + package="com.example.car_renting"> diff --git a/images/avatar.png b/images/avatar.png new file mode 100644 index 0000000..54902b9 Binary files /dev/null and b/images/avatar.png differ diff --git a/images/car1.png b/images/car1.png new file mode 100644 index 0000000..2458cfd Binary files /dev/null and b/images/car1.png differ diff --git a/images/waves.png b/images/waves.png new file mode 100644 index 0000000..51b50c1 Binary files /dev/null and b/images/waves.png differ diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 5d430f2..ef546c2 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -291,7 +291,7 @@ ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.example.contacts01; + PRODUCT_BUNDLE_IDENTIFIER = com.example.carRenting; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; @@ -415,7 +415,7 @@ ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.example.contacts01; + PRODUCT_BUNDLE_IDENTIFIER = com.example.carRenting; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -434,7 +434,7 @@ ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.example.contacts01; + PRODUCT_BUNDLE_IDENTIFIER = com.example.carRenting; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index e2eed25..2976f0b 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -11,7 +11,7 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleName - contacts_01 + car_renting CFBundlePackageType APPL CFBundleShortVersionString diff --git a/lib/BuilderSecondPage.dart b/lib/BuilderSecondPage.dart new file mode 100644 index 0000000..08d8547 --- /dev/null +++ b/lib/BuilderSecondPage.dart @@ -0,0 +1,354 @@ +import 'package:flutter/material.dart'; +import 'dart:math'; + +import 'ListViewCar.dart'; + +Widget BuildSecondPageBody(BuildContext context) { + return Container( + height: MediaQuery.of(context).size.height, + width: MediaQuery.of(context).size.width, + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage("images/waves.png"), + fit: BoxFit.fill, + ), + borderRadius: BorderRadius.all(Radius.circular(20)), + ), + child: Column(children: [ + BuildListViewCars(context), + Padding( + padding: const EdgeInsets.all(15), + child: Row( + children: [ + Text( + 'Trip Dates', + style: TextStyle( + color: Colors.white, + fontSize: 20, + fontWeight: FontWeight.bold), + ), + ], + ), + ), + Container( + height: 70, + width: MediaQuery.of(context).size.width - 50, + child: CustomPaint( + painter: CurvePainter(), + child: Row( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + height: 50, + width: 50, + decoration: BoxDecoration( + color: Colors.pink, + borderRadius: BorderRadius.all(Radius.circular(15)), + ), + child: Icon( + Icons.date_range_rounded, + color: Colors.white, + ), + ), + ), + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + '2020-5-5 2021-5-8', + style: TextStyle(color: Colors.grey, fontSize: 15), + )), + ), + ////////////////////////////////////////////////////////////////////// + //Expanded(child: Container()), + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + height: 50, + width: 50, + decoration: BoxDecoration( + color: Colors.blue, + borderRadius: BorderRadius.all(Radius.circular(15)), + ), + child: Padding( + padding: const EdgeInsets.all(0), + child: Row( + children: [ + IconButton( + onPressed: () {}, + icon: Icon( + Icons.double_arrow_rounded, + color: Colors.white, + size: 20, + ), + ) + ], + ), + ), + ), + ), + ////////////////////////////////////////////////////////////////////// + ], + ), + ), + ), + Padding( + padding: const EdgeInsets.all(15), + child: Row( + children: [ + Text( + 'Pickup & Return ', + style: TextStyle( + color: Colors.white, + fontSize: 20, + fontWeight: FontWeight.bold), + ), + ], + ), + ), + Container( + height: 70, + width: MediaQuery.of(context).size.width - 50, + child: CustomPaint( + painter: CurvePainter(), + child: Row( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + height: 50, + width: 50, + decoration: BoxDecoration( + color: Colors.pink, + borderRadius: BorderRadius.all(Radius.circular(15)), + ), + child: Icon( + Icons.date_range_rounded, + color: Colors.white, + ), + ), + ), + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + 'Iraq, baghdad', + style: TextStyle(color: Colors.grey, fontSize: 15), + )), + ), + ////////////////////////////////////////////////////////////////////// + //Expanded(child: Container()), + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + height: 50, + width: 50, + decoration: BoxDecoration( + color: Colors.blue, + borderRadius: BorderRadius.all(Radius.circular(15)), + ), + child: Padding( + padding: const EdgeInsets.all(0), + child: Row( + children: [ + IconButton( + onPressed: () {}, + icon: Icon( + Icons.double_arrow_rounded, + color: Colors.white, + size: 20, + ), + ) + ], + ), + ), + ), + ), + ////////////////////////////////////////////////////////////////////// + ], + ), + ), + ), + Expanded(child: Container()), + Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topRight: Radius.circular(40.0), + topLeft: Radius.circular(40.0), + ), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 3, + blurRadius: 5, + offset: Offset(0, 3), // changes position of shadow + ), + ], + ), + height: 100, + width: MediaQuery.of(context).size.width, + child: Row( + children: [ + Padding( + padding: const EdgeInsets.all(8), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.all(4), + child: Text( + 'Total', + style: TextStyle(color: Colors.grey, fontSize: 13), + )), + Padding( + padding: const EdgeInsets.all(4), + child: Text( + '\$999/trip', + style: TextStyle( + color: Colors.grey, + fontSize: 15, + fontWeight: FontWeight.bold), + )), + ], + ), + ), + Expanded(child: Container()), + + ////////////////////////////////////////////////////////////////////// + //Expanded(child: Container()), + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + height: 50, + width: 150, + decoration: BoxDecoration( + color: Colors.red, + borderRadius: BorderRadius.all(Radius.circular(20)), + ), + child: Padding( + padding: const EdgeInsets.all(0), + child: Center( + child: Text( + 'Go to Checkout', + style: TextStyle(color: Colors.white, fontSize: 15), + ), + )), + ), + ), + ////////////////////////////////////////////////////////////////////// + ], + ), + ), + ]), + ); +} + +class CurvePainter extends CustomPainter { + @override + void paint(Canvas canvas, Size size) { + final paint = Paint()..color = Colors.white; + + //canvas.drawPath(backgroundPath, paint); + + var path = Path(); + path.lineTo(0, size.height - 20); + path.quadraticBezierTo(0.0, size.height, 20.0, size.height); + + path.lineTo(size.width - 50, size.height); + path.quadraticBezierTo( + size.width - 80, size.height / 2, size.width - 50, 0); + + path.lineTo(size.width, 0); + + path.lineTo(20.0, 0); + path.quadraticBezierTo(0.0, 0.0, 0.0, 20.0); + + //path.lineTo(size.width, 0); + + //path.lineTo(0, 0); + // canvas.drawRRect(shapeBounds, paint); + canvas.drawShadow(path, Colors.grey, 2, false); + + canvas.drawPath(path, paint); + } + + @override + bool shouldRepaint(CustomPainter oldDelegate) { + return true; + } +} +/** + * Stack( + overflow: Overflow.visible, + children: [ + Container( + height: 350, + width: MediaQuery.of(context).size.width, + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage("images/waves.png"), + fit: BoxFit.fill, + ), + borderRadius: BorderRadius.all(Radius.circular(20)), + ), + ), + Positioned( + width: MediaQuery.of(context).size.width, + height: 300, + top: MediaQuery.of(context).size.width / 2, + //right: MediaQuery.of(context).size.width / 2, + // left: MediaQuery.of(context).size.width / 2, + child: ListView( + // This next line does the trick. + scrollDirection: Axis.horizontal, + children: [ + Container( + decoration: BoxDecoration( + color: Colors.blue, + boxShadow: [ + BoxShadow( + color: Colors.black54, + blurRadius: 10.0, + spreadRadius: 2.0, + offset: Offset(5.0, 5.0), + ), + ], + borderRadius: BorderRadius.all(Radius.circular(30)), + ), + alignment: Alignment.center, + width: MediaQuery.of(context).size.width, + height: 200, + child: Text( + 'Container 3', + style: TextStyle(fontSize: 18.0, color: Colors.white), + ), + ), + Container( + decoration: BoxDecoration( + color: Colors.blue, + boxShadow: [ + BoxShadow( + color: Colors.black54, + blurRadius: 10.0, + spreadRadius: 2.0, + offset: Offset(5.0, 5.0), + ), + ], + borderRadius: BorderRadius.all(Radius.circular(30)), + ), + alignment: Alignment.center, + width: MediaQuery.of(context).size.width, + height: 200, + child: Text( + 'Container 3', + style: TextStyle(fontSize: 18.0, color: Colors.white), + ), + ), + ], + ), + ), + ], + ), + */ diff --git a/lib/ListViewCar.dart b/lib/ListViewCar.dart new file mode 100644 index 0000000..b445e1e --- /dev/null +++ b/lib/ListViewCar.dart @@ -0,0 +1,152 @@ +import 'package:flutter/material.dart'; +import 'dart:math'; + +Widget BuildListViewCars(BuildContext context) { + return Padding( + padding: const EdgeInsets.fromLTRB(0, 150, 0, 0), + child: Stack( + overflow: Overflow.visible, + children: [ + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(50)), + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Colors.black, + blurRadius: 8, + spreadRadius: 1, + offset: Offset(1, 1), + ), + ], + ), + alignment: Alignment.centerRight, + width: 300, + height: 300, + child: Text( + 'Container 1', + style: TextStyle(fontSize: 18.0, color: Colors.white), + ), + ), + Positioned( + left: 40, + top: -70, + child: Column( + children: [ + Image.asset( + 'images/car1.png', + scale: 5, + ), + Text( + 'White Car', + style: TextStyle( + color: Colors.black54, + fontSize: 30, + fontWeight: FontWeight.bold), + ), + Text( + '4 Doors | Sport', + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.normal), + ), + Padding( + padding: const EdgeInsets.all(15), + child: Row( + children: [ + Icon( + Icons.star, + color: Colors.yellow, + ), + Icon( + Icons.star, + color: Colors.yellow, + ), + Icon( + Icons.star, + color: Colors.yellow, + ), + Icon( + Icons.star, + color: Colors.yellow, + ), + Icon( + Icons.star_border_outlined, + color: Colors.yellow, + ), + Text( + '(33k)', + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.normal), + ), + ], + ), + ), + Row( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + Icon( + Icons.autorenew_rounded, + size: 30, + ), + Text( + 'Automatic', + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.normal), + ), + ], + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + Icon( + Icons.ac_unit, + size: 30, + ), + Text( + 'Air Con', + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.normal), + ), + ], + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + Icon( + Icons.person, + size: 30, + ), + Text( + '5 Seater', + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.normal), + ), + ], + ), + ), + ], + ) + ], + ), + ), + ], + ), + ); +} diff --git a/lib/SecondPage.dart b/lib/SecondPage.dart new file mode 100644 index 0000000..f7330a6 --- /dev/null +++ b/lib/SecondPage.dart @@ -0,0 +1,23 @@ +import 'package:flutter/material.dart'; + +import 'BuilderSecondPage.dart'; + +class SecondPage extends StatelessWidget { + const SecondPage({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scaffold( + extendBodyBehindAppBar: true, + appBar: AppBar( + leading: IconButton( + icon: Icon(Icons.arrow_back_ios_sharp, color: Colors.white), + onPressed: () => Navigator.of(context).pop(), + ), + backgroundColor: Color(0x00000000), + elevation: 0, + ), + body: SingleChildScrollView(child: BuildSecondPageBody(context)), + ); + } +} diff --git a/lib/ShapedCard.dart b/lib/ShapedCard.dart new file mode 100644 index 0000000..d6e02ac --- /dev/null +++ b/lib/ShapedCard.dart @@ -0,0 +1,182 @@ +import 'package:flutter/material.dart'; +import 'dart:math'; + +import 'SecondPage.dart'; + +Widget BuildShapedCard(BuildContext context, String image, String star, + String description, int deals) { + return Padding( + padding: const EdgeInsets.all(10), + child: Container( + height: 300, + width: MediaQuery.of(context).size.width - 50, + child: CustomPaint( + painter: CurvePainter(), + child: Column( + children: [ + Padding( + padding: const EdgeInsets.all(10), + child: Row( + children: [ + Container( + height: 35, + width: 60, + decoration: BoxDecoration( + color: Colors.orange, + borderRadius: BorderRadius.all(Radius.circular(15)), + ), + child: Padding( + padding: const EdgeInsets.all(6), + child: Row( + children: [ + Icon( + Icons.star, + color: Colors.white, + size: 20, + ), + Text( + star, + style: TextStyle( + fontSize: 15, + color: Colors.white, + fontWeight: FontWeight.bold), + ) + ], + ), + ), + ), + + ////text + /// + Expanded(child: Container()), + Text( + '$deals Deals', + style: TextStyle( + fontSize: 15, + color: Colors.green[200], + fontWeight: FontWeight.bold), + ) + ], + ), + ), + Center( + child: Image.asset( + image, //"images/car1.png", + scale: 5, + ), + ), + Expanded(child: Container()), + Padding( + padding: const EdgeInsets.all(10), + child: Row( + children: [ + Column( + children: [ + Padding( + padding: const EdgeInsets.all(5), + child: Text( + description, + style: TextStyle( + fontSize: 15, + color: Colors.black87, + fontWeight: FontWeight.bold), + ), + ), + Text( + 'From \$192/per day', + style: TextStyle( + fontSize: 10, + color: Colors.black87, + fontWeight: FontWeight.normal), + ), + ], + ), + Expanded(child: Container()), + Padding( + padding: const EdgeInsets.fromLTRB(20, 20, 0, 0), + child: Container( + height: 50, + width: 50, + decoration: BoxDecoration( + color: Colors.blue, + borderRadius: BorderRadius.all(Radius.circular(15)), + boxShadow: [ + BoxShadow( + color: Colors.grey, + blurRadius: 5, + spreadRadius: 1, + offset: Offset(2, 2), + ), + ], + ), + child: Padding( + padding: const EdgeInsets.all(0), + child: Row( + children: [ + IconButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => SecondPage()), + ); + }, + icon: Icon( + Icons.double_arrow_rounded, + color: Colors.white, + size: 20, + ), + ) + ], + ), + ), + ), + ), + ], + ), + ) + ], + ), + ), + ), + ); +} + +class CurvePainter extends CustomPainter { + @override + void paint(Canvas canvas, Size size) { + final paint = Paint()..color = Colors.white; + + //canvas.drawPath(backgroundPath, paint); + + var path = Path(); + path.lineTo(0, size.height - 20); + path.quadraticBezierTo(0.0, size.height, 20.0, size.height); + + path.lineTo(size.width - 90, size.height); + + path.lineTo(size.width - 70, size.height); + path.quadraticBezierTo( + size.width - 85, size.height - 85, size.width, size.height - 70); + path.lineTo(size.width, size.height - 70); + + path.lineTo(size.width, 20); + path.quadraticBezierTo(size.width, 10, size.width - 10, 0); + + path.lineTo(20.0, 0); + path.quadraticBezierTo(0.0, 0.0, 0.0, 20.0); + + //path.lineTo(size.width, 0); + + //path.lineTo(0, 0); + // canvas.drawRRect(shapeBounds, paint); + canvas.drawShadow(path, Colors.grey, 10, false); + + canvas.drawPath(path, paint); + } + + @override + bool shouldRepaint(CustomPainter oldDelegate) { + return true; + } +} diff --git a/lib/TopCard.dart b/lib/TopCard.dart new file mode 100644 index 0000000..98932e7 --- /dev/null +++ b/lib/TopCard.dart @@ -0,0 +1,133 @@ +import 'package:flutter/material.dart'; + +import 'ShapedCard.dart'; + +Widget BuildTopCard(BuildContext context) { + return SingleChildScrollView( + child: Column( + children: [ + Container( + height: 300, + width: MediaQuery.of(context).size.width, + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage("images/waves.png"), + fit: BoxFit.fill, + ), + borderRadius: BorderRadius.all(Radius.circular(20)), + ), + child: Padding( + padding: const EdgeInsets.fromLTRB(15, 125, 0, 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Expanded(child: Container()), + const Text( + 'Choose a Car', + style: TextStyle( + fontSize: 30, + color: Colors.white, + fontWeight: FontWeight.bold), + ), + Padding( + padding: const EdgeInsets.fromLTRB(0, 8, 8, 8), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + height: 70, + width: MediaQuery.of(context).size.width - 75, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(15)), + ), + child: Row( + children: [ + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: TextField( + autofocus: false, + style: TextStyle(color: Colors.white), + decoration: InputDecoration( + prefixIcon: Icon( + Icons.location_on_outlined, + color: Colors.grey, + ), + border: InputBorder.none, + filled: true, + fillColor: Colors.white, + hintStyle: TextStyle(color: Colors.grey), + hintText: 'Florida, USA', + hoverColor: Colors.grey, + ), + ), + ), + ), + ////////////////////////////////////////////////////////////////////// + //Expanded(child: Container()), + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + height: 50, + width: 50, + decoration: BoxDecoration( + color: Colors.pink, + borderRadius: + BorderRadius.all(Radius.circular(15)), + ), + child: Icon( + Icons.date_range_rounded, + color: Colors.white, + ), + ), + ), + ////////////////////////////////////////////////////////////////////// + ], + ), + ), + IconButton( + onPressed: () {}, + icon: Icon( + Icons.tune_rounded, + color: Colors.white, + size: 50, + ), + ), + ], + ), + ), + ], + ), + )), + //////////////// + /// + Padding( + padding: const EdgeInsets.fromLTRB(15, 30, 15, 30), + child: Row( + children: [ + const Text( + '23 Results', + style: TextStyle( + fontSize: 20, + color: Colors.black87, + fontWeight: FontWeight.bold), + ), + Expanded(child: Container()), + IconButton( + onPressed: () {}, + icon: Icon( + Icons.more_horiz_outlined, + color: Colors.black87, + size: 40, + ), + ), + ], + ), + ), + BuildShapedCard(context, "images/car1.png", '4.5', 'white Car', 15), + BuildShapedCard(context, "images/car1.png", '4.5', 'white Car', 15), + ], + ), + ); +} diff --git a/lib/main.dart b/lib/main.dart index 2c084ed..0d8e14a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,255 +1,57 @@ import 'package:flutter/material.dart'; -import 'dart:math' as math; -void main() { - runApp(const MyApp()); -} -class Contact { - String image; - String name; - String mobileNumber; - DateTime date; - bool isIncoming; +import 'TopCard.dart'; - Contact(this.image, this.name, this.mobileNumber, this.date, this.isIncoming); +void main() { + runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); + // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( - title: 'Flutter Demo 2', - theme: ThemeData( - primarySwatch: Colors.blue, - ), - debugShowCheckedModeBanner: false, - home: const MyHomePage(title: 'Contacts App'), + title: 'Flutter Demo', + home: const MyHomePage(), ); } } class MyHomePage extends StatefulWidget { - const MyHomePage({Key? key, required this.title}) : super(key: key); - - final String title; + const MyHomePage({Key? key}) : super(key: key); @override State createState() => _MyHomePageState(); } class _MyHomePageState extends State { - int _selectedIndex = 2; - static const TextStyle optionStyle = - TextStyle(fontSize: 30, fontWeight: FontWeight.bold); - static late List _pages; - - _MyHomePageState() { - _pages = [ - buildContactsList(), - buildFavoritesGridView(), - // Text('hello'), - Text( - 'Index 2: School', - style: optionStyle, - ), - ]; - } - - void _onItemTapped(int index) { - setState(() { - _selectedIndex = index; - }); - } - - var contacts = [ - Contact( - 'https://i.pravatar.cc/300', - 'Ahmed', - '71766137347', - DateTime.now().add( - const Duration(seconds: 3), - ), - true, - ), - Contact( - 'https://i.pravatar.cc/301', - 'Ali', - '71766137347', - DateTime.now().add( - const Duration(days: 1), - ), - false, - ), - Contact( - 'https://i.pravatar.cc/302', - 'Kamal', - '71766137347', - DateTime.now().add( - const Duration(days: 3), - ), - true, - ), - Contact( - 'https://i.pravatar.cc/303', - 'Mohammad', - '71766137347', - DateTime.now().add( - const Duration(days: 5), - ), - true, - ), - Contact( - 'https://i.pravatar.cc/304', - 'Mohammad', - '71766137347', - DateTime.now().add( - const Duration(days: 5), - ), - false, - ), - Contact( - 'https://i.pravatar.cc/305', - 'Hussein', - '71766137347', - DateTime.now().add( - const Duration(days: 6), - ), - false, - ), - Contact( - 'https://i.pravatar.cc/306', - 'Aboud', - '71766137347', - DateTime.now().add( - const Duration(days: 7), - ), - false, - ), - Contact( - 'https://i.pravatar.cc/307', - 'Osama', - '71766137347', - DateTime.now().add( - const Duration(days: 6), - ), - false, - ), - ]; - - Widget buildFavoritesGridView() { - return Column( - children: [ - Text('Favorites'), - Divider(thickness: 4,), - Expanded( - child: GridView.count( - crossAxisCount: 3, - children: List.generate(5, (index) { - var personColor = Color((math.Random().nextDouble() * 0xFFFFFF).toInt()) - .withOpacity(1.0); - return Center( - child: Container( - width: 120, - height: 120, - child: Text( - contacts[index].name[0], - style: TextStyle(fontSize: 40), - ), - alignment: Alignment.center, - decoration: - BoxDecoration(shape: BoxShape.circle, color: personColor), - ), - ); - }), - ), - ), - ], - ); - } - - Widget buildContactItem(Contact _contact) { - return Card( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - children: [ - CircleAvatar( - backgroundImage: NetworkImage(_contact.image), - ), - Padding( - padding: const EdgeInsets.all(16), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - _contact.name, - style: const TextStyle(fontWeight: FontWeight.bold), - ), - Text(_contact.mobileNumber), - ], - ), - ), - Text(_contact.date.toIso8601String().split('T').first), - Expanded( - child: Container(), - ), - if (_contact.isIncoming) - Icon( - Icons.arrow_downward, - color: Colors.red, - ) - else - Icon( - Icons.arrow_upward, - color: Colors.green, - ) - ], - ), - ), - ); - } - - Widget buildContactsList() { - return ListView.builder( - itemBuilder: (_context, index) { - return buildContactItem(contacts[index]); - }, - itemCount: contacts.length, - ); - } - @override Widget build(BuildContext context) { return Scaffold( + extendBodyBehindAppBar: true, + //backgroundColor: Colors.red, appBar: AppBar( - title: Text(widget.title), - ), - body: Center( - child: _pages[_selectedIndex], - ), - bottomNavigationBar: BottomNavigationBar( - items: const [ - BottomNavigationBarItem( - icon: Icon(Icons.home), - label: 'Recent', - ), - BottomNavigationBarItem( - icon: Icon(Icons.favorite), - label: 'Favorites', - ), - BottomNavigationBarItem( - icon: Icon(Icons.access_time_outlined), - label: 'School', - activeIcon: Icon(Icons.access_time_filled) + backgroundColor: Color(0x00000000), + elevation: 0, + title: Text("Title"), + actions: [ + IconButton( + onPressed: () {}, + icon: Icon( + Icons.sort_rounded, + size: 40, + ), ), + Expanded(child: Container()), + CircleAvatar( + backgroundColor: Colors.white, + backgroundImage: AssetImage('images/avatar.png'), + ) ], - currentIndex: _selectedIndex, - selectedItemColor: Colors.amber[800], - onTap: _onItemTapped, ), + body: BuildTopCard(context), ); } } diff --git a/pubspec.yaml b/pubspec.yaml index 1c93cc7..6fb2599 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,4 +1,4 @@ -name: contacts_01 +name: car_renting description: A new Flutter project. # The following line prevents the package from being accidentally published to @@ -58,8 +58,10 @@ flutter: uses-material-design: true # To add assets to your application, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg + assets: + - images/waves.png + - images/car1.png + - images/avatar.png # - images/a_dot_ham.jpeg # An image asset can refer to one or more resolution-specific "variants", see diff --git a/screenshots/s1.png b/screenshots/s1.png new file mode 100644 index 0000000..d34c3f6 Binary files /dev/null and b/screenshots/s1.png differ diff --git a/screenshots/s2.png b/screenshots/s2.png new file mode 100644 index 0000000..5967667 Binary files /dev/null and b/screenshots/s2.png differ diff --git a/test/widget_test.dart b/test/widget_test.dart index 5f578bd..5554461 100644 --- a/test/widget_test.dart +++ b/test/widget_test.dart @@ -8,7 +8,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:contacts_01/main.dart'; +import 'package:car_renting/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { diff --git a/web/index.html b/web/index.html index d2606e7..e7dffc3 100644 --- a/web/index.html +++ b/web/index.html @@ -23,10 +23,10 @@ - + - contacts_01 + car_renting diff --git a/web/manifest.json b/web/manifest.json index 9631a79..acbef22 100644 --- a/web/manifest.json +++ b/web/manifest.json @@ -1,6 +1,6 @@ { - "name": "contacts_01", - "short_name": "contacts_01", + "name": "car_renting", + "short_name": "car_renting", "start_url": ".", "display": "standalone", "background_color": "#0175C2",