diff --git a/README.md b/README.md index 9152445..3b8361c 100644 --- a/README.md +++ b/README.md @@ -12,3 +12,6 @@ A few resources to get you started if this is your first Flutter project: 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. + +![Screenshot (73)](https://user-images.githubusercontent.com/91218301/136259910-aa45e293-cee2-417a-84de-a693088fa6f5.png) +![Screenshot (74)](https://user-images.githubusercontent.com/91218301/136259918-878a0b5d-3d71-44dd-879e-630382c6a3df.png) diff --git a/Task2/build.gradle b/Task2/build.gradle new file mode 100644 index 0000000..a13a838 --- /dev/null +++ b/Task2/build.gradle @@ -0,0 +1,30 @@ +buildscript { + ext.kotlin_version = '1.3.50' + repositories { + google() + mavenCentral() + } + + dependencies { + classpath 'com.android.tools.build:gradle:4.1.0' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath 'com.google.gms:google-services:4.3.10' + } +} + +allprojects { + repositories { + google() + mavenCentral() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" + project.evaluationDependsOn(':app') +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/Task2/loading.dart b/Task2/loading.dart new file mode 100644 index 0000000..10e5488 --- /dev/null +++ b/Task2/loading.dart @@ -0,0 +1,12 @@ +import 'package:flutter/material.dart'; + +class Loading extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + body: Center( + child: CircularProgressIndicator(), + ), + ); + } +} diff --git a/Task2/main.dart b/Task2/main.dart new file mode 100644 index 0000000..0eddf54 --- /dev/null +++ b/Task2/main.dart @@ -0,0 +1,36 @@ + + +import 'package:firebase_core/firebase_core.dart'; +import 'package:flutter/material.dart'; +import 'package:todo/loading.dart'; +import 'package:todo/todo_list.dart'; + + +void main() => runApp(MyApp()); + +class MyApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return FutureBuilder( + future: Firebase.initializeApp(), + builder: (context, snapshot) { + if (snapshot.hasError) { + return Scaffold( + body: Center(child: Text(snapshot.error.toString())), + ); + } + if (snapshot.connectionState == ConnectionState.waiting) { + return Loading(); + } + return MaterialApp( + debugShowCheckedModeBanner: false, + home: TodoList(), + theme: ThemeData( + scaffoldBackgroundColor: Colors.grey[900], + primarySwatch: Colors.pink, + ), + ); + }, + ); + } +} diff --git a/Task2/model/todo.dart b/Task2/model/todo.dart new file mode 100644 index 0000000..c4c658e --- /dev/null +++ b/Task2/model/todo.dart @@ -0,0 +1,7 @@ +class Todo { + String uid; + String title; + bool isComplet; + + Todo({required this.uid, required this.title, required this.isComplet}); +} diff --git a/Task2/services/database_services.dart b/Task2/services/database_services.dart new file mode 100644 index 0000000..547bb54 --- /dev/null +++ b/Task2/services/database_services.dart @@ -0,0 +1,41 @@ +import 'package:cloud_firestore/cloud_firestore.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:todo/model/todo.dart'; + +class DatabaseService { + CollectionReference todosCollection = + FirebaseFirestore.instance.collection("Todos"); + + Future createNewTodo(String title) async { + return await todosCollection.add({ + "title": title, + "isComplet": false, + }); + } + + Future completTask(uid) async { + await todosCollection.doc(uid).update({"isComplet": true}); + } + + Future removeTodo(uid) async { + await todosCollection.doc(uid).delete(); + } + + List todoFromFirestore(QuerySnapshot snapshot) { + if (snapshot != null) { + return snapshot.docs.map((e) { + return Todo( + isComplet: e.data()["isComplet"], + title: e.data()["title"], + uid: e.id, + ); + }).toList(); + } else { + return null; + } + } + + Stream> listTodos() { + return todosCollection.snapshots().map(todoFromFirestore); + } +} diff --git a/Task2/todo_android.iml b/Task2/todo_android.iml new file mode 100644 index 0000000..5e74ee6 --- /dev/null +++ b/Task2/todo_android.iml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + diff --git "a/Task2\\" "b/Task2\\" new file mode 100644 index 0000000..8b13789 --- /dev/null +++ "b/Task2\\" @@ -0,0 +1 @@ + diff --git a/assets/images/account.svg b/assets/images/account.svg new file mode 100644 index 0000000..1f80476 --- /dev/null +++ b/assets/images/account.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/account_active.svg b/assets/images/account_active.svg new file mode 100644 index 0000000..7f444fb --- /dev/null +++ b/assets/images/account_active.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/add.svg b/assets/images/add.svg new file mode 100644 index 0000000..d69add3 --- /dev/null +++ b/assets/images/add.svg @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/add_active.svg b/assets/images/add_active.svg new file mode 100644 index 0000000..84d2ebe --- /dev/null +++ b/assets/images/add_active.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/camera.svg b/assets/images/camera.svg new file mode 100644 index 0000000..7eeba7f --- /dev/null +++ b/assets/images/camera.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/heart.svg b/assets/images/heart.svg new file mode 100644 index 0000000..bd7fee6 --- /dev/null +++ b/assets/images/heart.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/heart_active.svg b/assets/images/heart_active.svg new file mode 100644 index 0000000..6438495 --- /dev/null +++ b/assets/images/heart_active.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/heart_red.svg b/assets/images/heart_red.svg new file mode 100644 index 0000000..31bd23f --- /dev/null +++ b/assets/images/heart_red.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/home.svg b/assets/images/home.svg new file mode 100644 index 0000000..a0385d2 --- /dev/null +++ b/assets/images/home.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/home_active.svg b/assets/images/home_active.svg new file mode 100644 index 0000000..d6d4bbe --- /dev/null +++ b/assets/images/home_active.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/logo.svg b/assets/images/logo.svg new file mode 100644 index 0000000..ebd7000 --- /dev/null +++ b/assets/images/logo.svg @@ -0,0 +1,6 @@ + + + diff --git a/assets/images/search.svg b/assets/images/search.svg new file mode 100644 index 0000000..388afe7 --- /dev/null +++ b/assets/images/search.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/search_active.svg b/assets/images/search_active.svg new file mode 100644 index 0000000..09bf2ca --- /dev/null +++ b/assets/images/search_active.svg @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/share.svg b/assets/images/share.svg new file mode 100644 index 0000000..fc2598c --- /dev/null +++ b/assets/images/share.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/video.svg b/assets/images/video.svg new file mode 100644 index 0000000..a849067 --- /dev/null +++ b/assets/images/video.svg @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/main.dart b/lib/main.dart index 2c084ed..7d42e59 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,255 +1,9 @@ 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; - - Contact(this.image, this.name, this.mobileNumber, this.date, this.isIncoming); -} - -class MyApp extends StatelessWidget { - const MyApp({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return MaterialApp( - title: 'Flutter Demo 2', - theme: ThemeData( - primarySwatch: Colors.blue, - ), - debugShowCheckedModeBanner: false, - home: const MyHomePage(title: 'Contacts App'), - ); - } -} - -class MyHomePage extends StatefulWidget { - const MyHomePage({Key? key, required this.title}) : super(key: key); - - final String title; +import 'package:instagram_clone/pages/root_app.dart'; - @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( - 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) - ), - ], - currentIndex: _selectedIndex, - selectedItemColor: Colors.amber[800], - onTap: _onItemTapped, - ), - ); - } +void main() { + runApp(MaterialApp( + debugShowCheckedModeBanner: false, + home: RootApp(), + )); } diff --git a/lib/model/example_list.dart b/lib/model/example_list.dart new file mode 100644 index 0000000..1a02508 --- /dev/null +++ b/lib/model/example_list.dart @@ -0,0 +1,6 @@ +class ExampleList { + const ExampleList({required this.title, required this.subTitle}); + + final String title; + final String subTitle; +} diff --git a/lib/model/user.dart b/lib/model/user.dart new file mode 100644 index 0000000..056a1c4 --- /dev/null +++ b/lib/model/user.dart @@ -0,0 +1,5 @@ +class User { + User({required this.name, required this.phone}); + final String name; + final String phone; +} diff --git a/lib/pages/account_page.dart b/lib/pages/account_page.dart new file mode 100644 index 0000000..86b06df --- /dev/null +++ b/lib/pages/account_page.dart @@ -0,0 +1,297 @@ + +import 'package:flutter/material.dart'; +import 'package:flutter_icons/flutter_icons.dart'; +import 'package:instagram_clone/theme/colors.dart'; +import 'package:instagram_clone/util/account_images_json.dart'; +import 'package:instagram_clone/util/constant.dart'; + +class AccountPage extends StatefulWidget { + @override + _AccountPageState createState() => _AccountPageState(); +} + +class _AccountPageState extends State { + int selectedIndex = 0; + + @override + Widget build(BuildContext context) { + var size = MediaQuery.of(context).size; + return Scaffold( + appBar: getAppBar(), + body: getBody(size), + ); + } + + Widget getAppBar() { + return PreferredSize( + preferredSize: Size.fromHeight(55), + child: SafeArea( + child: Padding( + padding: const EdgeInsets.only(left: 10, right: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Icon(Feather.lock, size: 18,), + SizedBox(width: 10), + Text( + username, + style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), + ) + ], + ), + Row( + children: [ + IconButton( + splashRadius: 15, + icon: Icon(AntDesign.plus), + onPressed: () {}, + ), + IconButton( + splashRadius: 15, + icon: Icon(FontAwesome.bars), + onPressed: () {}, + ), + ], + ), + ], + ), + ), + ), + ); + } + + Widget getBody(size) { + return ListView( + children: [ + Padding( + padding: const EdgeInsets.only(left: 10, right: 10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + width: (size.width - 20) * 0.3, + child: Stack( + children: [ + Container( + height: 100, + width: 100, + decoration: BoxDecoration( + shape: BoxShape.circle, + border: Border.all(width: 1, color: bgGrey), + image: DecorationImage( + image: NetworkImage(profile), + fit: BoxFit.cover + ) + ), + ), + Positioned( + bottom: 0, + right: 25, + child: Container( + height: 25, + width: 25, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: primary, + border: Border.all(width: 1, color: bgWhite) + ), + child: Center( + child: Icon(Icons.add, color: bgWhite), + ), + ), + ), + ], + ), + ), + Container( + width: (size.width - 20) * 0.7, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Column( + children: [ + Text( + "61", + style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + ), + Text( + "Posts", + style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, height: 1.5), + ), + ], + ), + Column( + children: [ + Text( + "117", + style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + ), + Text( + "Follwers", + style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, height: 1.5), + ), + ], + ), + Column( + children: [ + Text( + "173", + style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + ), + Text( + "Following", + style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, height: 1.5), + ), + ], + ), + ], + ), + ), + ], + ), + SizedBox(height: 15), + Text(instagramName), + Text(instagramBio), + SizedBox(height: 15), + Container( + height: 35, + width: (size.width - 20), + decoration: BoxDecoration( + border: Border.all(width: 1, color: bgGrey), + borderRadius: BorderRadius.circular(5), + color: bgLightGrey, + ), + child: Center( + child: Text("Edit Profile"), + ), + ), + SizedBox(height: 15), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "Story Highlights", + style: TextStyle(fontWeight: FontWeight.bold) + ), + Icon(FontAwesome.angle_down, size: 20) + ], + ), + ], + ), + ), + SizedBox(height: 15), + Container( + height: 0.5, + width: size.width, + decoration: BoxDecoration(color: bgGrey.withOpacity(0.8)), + ), + Padding( + padding: EdgeInsets.symmetric(vertical: 3), + child: Row( + children: [ + Container( + width: (size.width * 0.5), + child: IconButton( + splashRadius: 20, + icon: Icon(FontAwesome.th, color: selectedIndex == 0 ? textBlack : textBlack.withOpacity(0.5),), + onPressed: () { + setState(() { + selectedIndex = 0; + }); + }, + ), + ), + Container( + width: (size.width * 0.5), + child: IconButton( + splashRadius: 20, + icon: Icon(FontAwesome.id_badge, color: selectedIndex == 1 ? textBlack : textBlack.withOpacity(0.5),), + onPressed: () { + setState(() { + selectedIndex = 1; + }); + }, + ), + ), + ], + ), + ), + Column( + children: [ + Row( + children: [ + Container( + height: 1, + width: (size.width * 0.5), + decoration: BoxDecoration(color: selectedIndex == 0 ? bgDark : Colors.transparent), + ), + Container( + height: 1, + width: (size.width * 0.5), + decoration: BoxDecoration(color: selectedIndex == 1 ? bgDark : Colors.transparent), + ), + ], + ), + Container( + height: 0.5, + width: size.width, + decoration: BoxDecoration(color: bgGrey.withOpacity(0.8)), + ), + ], + ), + SizedBox(height: 3), + IndexedStack( + index: selectedIndex, + children: [ + getImages(size), + getImageWithTags(size), + ], + ), + ], + ); + } + + Widget getImages(size) { + return Wrap( + direction: Axis.horizontal, + spacing: 3, + runSpacing: 3, + children: List.generate(images.length, (index) { + return Container( + height: 150, + width: (size.width - 6) / 3, + decoration: BoxDecoration( + image: DecorationImage( + image: NetworkImage(images[index]), + fit: BoxFit.cover + ) + ), + ); + }) + ); + } + + Widget getImageWithTags(size) { + return Wrap( + direction: Axis.horizontal, + spacing: 3, + runSpacing: 3, + children: List.generate(imageWithTags.length, (index) { + return Container( + height: 150, + width: (size.width - 6) / 3, + decoration: BoxDecoration( + image: DecorationImage( + image: NetworkImage(imageWithTags[index]), + fit: BoxFit.cover + ) + ), + ); + }) + ); + } +} \ No newline at end of file diff --git a/lib/pages/activity_page.dart b/lib/pages/activity_page.dart new file mode 100644 index 0000000..9e4eb6d --- /dev/null +++ b/lib/pages/activity_page.dart @@ -0,0 +1,15 @@ +import 'package:flutter/material.dart'; + +class ActivityPage extends StatefulWidget { + @override + _ActivityPageState createState() => _ActivityPageState(); +} + +class _ActivityPageState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + body: Center(child: Text("Activity")), + ); + } +} \ No newline at end of file diff --git a/lib/pages/chat_detail_page.dart b/lib/pages/chat_detail_page.dart new file mode 100644 index 0000000..f98354a --- /dev/null +++ b/lib/pages/chat_detail_page.dart @@ -0,0 +1,294 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_icons/flutter_icons.dart'; +import 'package:instagram_clone/theme/colors.dart'; +import 'package:instagram_clone/util/chat_detail_json.dart'; +import 'package:instagram_clone/util/chat_json.dart'; +import 'package:keyboard_avoider/keyboard_avoider.dart'; + +class ChatDetailPage extends StatefulWidget { + @override + _ChatDetailPageState createState() => _ChatDetailPageState(); +} + +class _ChatDetailPageState extends State { + @override + Widget build(BuildContext context) { + var size = MediaQuery.of(context).size; + + return Scaffold( + appBar: getAppBar(), + body: getBody(size), + ); + } + + Widget getAppBar() { + return PreferredSize( + preferredSize: Size.fromHeight(55), + child: SafeArea( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + IconButton( + splashRadius: 20, + icon: Icon(Icons.arrow_back_ios, color: textBlack), + onPressed: () { + Navigator.pop(context); + } + ), + SizedBox(width: 10), + Container( + height: 33, + width: 33, + decoration: BoxDecoration( + shape: BoxShape.circle, + image: DecorationImage( + image: NetworkImage(chats[0]['profile']), + fit: BoxFit.cover + ) + ), + ), + SizedBox(width: 15), + Text( + chats[0]['username'], + style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), + ) + ], + ), + Row( + children: [ + IconButton( + splashRadius: 20, + icon: Icon(Feather.video), + onPressed: () {} + ), + SizedBox(width: 5), + IconButton( + splashRadius: 20, + icon: Icon(Feather.info), + onPressed: () {} + ), + ], + ), + ], + ), + ), + ); + } + + Widget getBody(size) { + return KeyboardAvoider( + autoScroll: true, + child: GestureDetector( + onTap: () { + FocusScope.of(context).unfocus(); + }, + child: ListView( + shrinkWrap: true, + children: [ + Container( + height: size.height * 0.83, + child: ListView( + children: List.generate(chatDetails.length, (index) { + return Padding( + padding: EdgeInsets.only(left: 10, right: 10), + child: ChatBubbles( + isMe: chatDetails[index]['isMe'], + profile: chatDetails[index]['profile'], + message: chatDetails[index]['message'], + messageNo: chatDetails[index]['messageNo'], + ), + ); + }) + ), + ), + Expanded( + child: Padding( + padding: const EdgeInsets.only(left: 15, right: 15, bottom: 10), + child: Container( + height: 50, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(20), + color: bgGrey.withOpacity(0.3), + ), + child: Padding( + padding: const EdgeInsets.all(5.0), + child: Row( + children: [ + Container( + width: (size.width - 40) * 0.1, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: primary + ), + child: Center( + child: Icon( + Feather.camera, color: textWhite + ), + ), + ), + Container( + width: (size.width - 40) * 0.6, + child: Padding( + padding: const EdgeInsets.only(top: 10, left: 10, right: 10), + child: TextField( + cursorColor: textBlack.withOpacity(0.5), + decoration: InputDecoration( + border: InputBorder.none, + hintText: "Message...", + hintStyle: TextStyle(fontSize: 16, color: textBlack.withOpacity(0.5)) + ), + ), + ), + ), + Container( + width: (size.width - 40) * 0.3, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Icon(SimpleLineIcons.microphone), + Icon(Feather.image), + Icon(MaterialCommunityIcons.sticker_emoji), + ], + ), + ), + ], + ), + ), + ), + ), + ), + ], + ), + ), + ); + } +} +class ChatBubbles extends StatelessWidget { + final bool isMe; + final String profile, message; + final int messageNo; + + const ChatBubbles({ + Key key, + this.isMe, + this.profile, + this.message, + this.messageNo + }) : super(key: key); + + @override + Widget build(BuildContext context) { + if(isMe) { + return Padding( + padding: EdgeInsets.only(top: 1.5, bottom: 1.5), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + decoration: BoxDecoration( + borderRadius: getBorderRadiusMessage(messageNo), + color: bgGrey.withOpacity(0.3), + ), + child: Padding( + padding: const EdgeInsets.all(10.0), + child: Text( + message, + style: TextStyle(fontSize: 16), + ), + ), + ), + ], + ), + ); + } else { + return Padding( + padding: EdgeInsets.only(top: 1.5, bottom: 1.5), + child: Row( + children: [ + Container( + height: 33, + width: 33, + decoration: BoxDecoration( + shape: BoxShape.circle, + image: DecorationImage( + image: NetworkImage(profile), + fit: BoxFit.cover + ) + ), + ), + SizedBox(width: 10), + Container( + decoration: BoxDecoration( + borderRadius: getBorderRadiusMessage(messageNo), + color: bgGrey.withOpacity(0.3), + ), + child: Padding( + padding: const EdgeInsets.all(10.0), + child: Text( + message, + style: TextStyle(fontSize: 16), + ), + ), + ), + ], + ), + ); + } + } + + getBorderRadiusMessage(messageNo) { + if (isMe) { + if(messageNo == 1) { + return BorderRadius.only( + topLeft: Radius.circular(20), + bottomLeft: Radius.circular(20), + topRight: Radius.circular(20), + bottomRight: Radius.circular(5), + ); + } else if (messageNo == 2) { + return BorderRadius.only( + topLeft: Radius.circular(20), + bottomLeft: Radius.circular(20), + topRight: Radius.circular(5), + bottomRight: Radius.circular(5), + ); + } else if (messageNo == 3) { + return BorderRadius.only( + topLeft: Radius.circular(20), + bottomLeft: Radius.circular(20), + topRight: Radius.circular(5), + bottomRight: Radius.circular(20), + ); + } else { + return BorderRadius.circular(20); + } + } else { + if(messageNo == 1) { + return BorderRadius.only( + topLeft: Radius.circular(20), + bottomLeft: Radius.circular(5), + topRight: Radius.circular(20), + bottomRight: Radius.circular(5), + ); + } else if (messageNo == 2) { + return BorderRadius.only( + topLeft: Radius.circular(5), + bottomLeft: Radius.circular(5), + topRight: Radius.circular(20), + bottomRight: Radius.circular(20), + ); + } else if (messageNo == 3) { + return BorderRadius.only( + topLeft: Radius.circular(5), + bottomLeft: Radius.circular(20), + topRight: Radius.circular(20), + bottomRight: Radius.circular(20), + ); + } else { + return BorderRadius.circular(20); + } + } + } +} \ No newline at end of file diff --git a/lib/pages/chat_page.dart b/lib/pages/chat_page.dart new file mode 100644 index 0000000..b66a703 --- /dev/null +++ b/lib/pages/chat_page.dart @@ -0,0 +1,298 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_icons/flutter_icons.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:instagram_clone/pages/chat_detail_page.dart'; +import 'package:instagram_clone/theme/colors.dart'; +import 'package:instagram_clone/util/chat_json.dart'; + +class ChatPage extends StatefulWidget { + @override + _ChatPageState createState() => _ChatPageState(); +} + +class _ChatPageState extends State { + int selectedIndex = 0; + @override + Widget build(BuildContext context) { + var size = MediaQuery.of(context).size; + return Scaffold( + appBar: getAppBar(), + body: getBody(size), + bottomSheet: getBottomSheet(), + ); + } + + Widget getAppBar() { + return PreferredSize( + preferredSize: Size.fromHeight(55), + child: SafeArea( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + IconButton( + splashRadius: 15, + icon: Icon(Icons.arrow_back_ios, color: textBlack), + onPressed: () { + Navigator.pop(context); + }, + ), + SizedBox(width: 10), + Text( + "Chats", + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.bold + ), + ), + ], + ), + Row( + children: [ + IconButton( + splashRadius: 20, + icon: Icon(Feather.video), + onPressed: () {}, + ), + SizedBox(width: 5), + IconButton( + splashRadius: 20, + icon: Icon(Feather.edit), + onPressed: () {}, + ), + ], + ), + ], + ), + ), + ); + } + + Widget getBody(size) { + return ListView( + children: [ + Column( + children: [ + SizedBox(height: 10), + Row( + children: [ + Container( + height: 45, + width: size.width * 0.5, + child: InkWell( + onTap: () { + setState(() { + selectedIndex = 0; + }); + }, + child: Center( + child: Text( + "Chats", + style: TextStyle(color: selectedIndex == 0 ? textBlack : textBlack.withOpacity(0.5)), + ), + ), + ), + ), + Container( + height: 45, + width: size.width * 0.5, + child: InkWell( + onTap: () { + setState(() { + selectedIndex = 1; + }); + }, + child: Center( + child: Text( + "Rooms", + style: TextStyle(color: selectedIndex == 1 ? textBlack : textBlack.withOpacity(0.5)), + ), + ), + ), + ), + ], + ), + Container( + height: 1, + width: size.width, + decoration: BoxDecoration(color: bgGrey), + ), + ], + ), + IndexedStack( + index: selectedIndex, + children: [ + getChats(size), + getRooms(size), + ], + ), + ], + ); + } + + Widget getChats(size) { + return Column( + children: [ + Padding( + padding: EdgeInsets.only(top: 15, left: 10, right: 10), + child: Container( + height: 41, + width: (size.width - 20), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + color: bgGrey.withOpacity(0.3), + ), + child: Padding( + padding: EdgeInsets.only(top: 5), + child: TextField( + cursorColor: textBlack.withOpacity(0.5), + decoration: InputDecoration( + border: InputBorder.none, + prefixIcon: Icon(Icons.search, color: textBlack.withOpacity(0.5),), + hintText: "Search", + hintStyle: TextStyle(color: textBlack.withOpacity(0.5)), + ) + ), + ), + ), + ), + SizedBox(height: 10), + Column( + children: List.generate(chats.length, (index) { + return InkWell( + onTap: () { + Navigator.push(context, MaterialPageRoute(builder: (_) => ChatDetailPage())); + }, + child: Padding( + padding: const EdgeInsets.all(10.0), + child: Row( + children: [ + Container( + height: (size.width - 20) * 0.15, + width: (size.width - 20) * 0.15, + child: Stack( + children: [ + Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + image: DecorationImage( + image: NetworkImage(chats[index]['profile']), + fit: BoxFit.cover + ) + ), + ), + chats[index]['dateTime'] == "now" + ? Positioned( + bottom: 0, + right: 0, + child: Container( + height: 18, + width: 18, + decoration: BoxDecoration( + shape: BoxShape.circle, + border: Border.all(width: 1, color: bgWhite), + color: success + ), + ), + ) + : Container(), + ], + ), + ), + Container( + width: (size.width - 20) * 0.7, + child: Padding( + padding: EdgeInsets.only(left: 15), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + chats[index]['username'], + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500), + ), + Text( + "${chats[index]['description']} • ${chats[index]['dateTime']}", + style: TextStyle(fontSize: 16, height: 1, color: textGrey), + ) + ], + ), + ), + ), + Container( + width: (size.width - 20) * 0.15, + alignment: Alignment.centerRight, + child: Icon(Feather.camera, color: textBlack.withOpacity(0.5),), + ), + ], + ), + ), + ); + }), + ), + ], + ); + } + + Widget getRooms(size) { + return Center( + child: Padding( + padding: EdgeInsets.only(top: 30, left: 20, right: 20), + child: Column( + children: [ + SvgPicture.asset("assets/images/video.svg", width: 100), + SizedBox(height: 20), + Text( + "Video Chat With Anyone", + style: TextStyle(fontSize: 23, fontWeight: FontWeight.bold), + ), + SizedBox(height: 15), + Text( + "Invite up to 50 people to join a video chat, even if they don't have Instagram or Messenger.", + textAlign: TextAlign.center, + style: TextStyle(fontSize: 14, height: 1.5, color: textBlack.withOpacity(0.8)), + ), + SizedBox(height: 20), + Container( + height: 50, + width: size.width, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + color: primary, + ), + child: Center( + child: Text("Create Room", style: TextStyle(color: textWhite)), + ), + ), + ], + ), + ), + ); + } + + Widget getBottomSheet() { + if (selectedIndex == 0) { + return Container( + height: 60, + decoration: BoxDecoration( + color: bgLightGrey, + border: Border(top: BorderSide(width: 1, color: bgGrey.withOpacity(0.3))) + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(FontAwesome.camera, color: primary,), + SizedBox(width: 10), + Text( + "Camera", + style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: primary), + ), + ], + ), + ); + } else { + return Container(height: 1,); + } + } +} \ No newline at end of file diff --git a/lib/pages/home_page.dart b/lib/pages/home_page.dart new file mode 100644 index 0000000..ea3f144 --- /dev/null +++ b/lib/pages/home_page.dart @@ -0,0 +1,318 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_icons/flutter_icons.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:instagram_clone/pages/chat_page.dart'; +import 'package:instagram_clone/theme/colors.dart'; +import 'package:instagram_clone/util/constant.dart'; +import 'package:instagram_clone/util/new_feed_json.dart'; +import 'package:instagram_clone/util/story_json.dart'; + +class HomePage extends StatefulWidget { + @override + _HomePageState createState() => _HomePageState(); +} + +class _HomePageState extends State { + @override + Widget build(BuildContext context) { + var size = MediaQuery.of(context).size; + return Scaffold( + appBar: getAppBar(), + body: getBody(size), + ); + } + + Widget getAppBar() { + return PreferredSize( + preferredSize: Size.fromHeight(55), + child: SafeArea( + child: Padding( + padding: EdgeInsets.all(8), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SvgPicture.asset("assets/images/logo.svg", width: 90), + IconButton( + splashRadius: 15, + icon: Icon(FontAwesome5Brands.facebook_messenger), + onPressed: () { + Navigator.push(context, MaterialPageRoute(builder: (_) => ChatPage())); + } + ) + ], + ), + ), + ), + ); + } + + Widget getBody(size) { + return ListView( + children: [ + SingleChildScrollView( + scrollDirection: Axis.horizontal, + padding: EdgeInsets.only(top: 5, left: 5, right: 5), + child: Row( + children: List.generate(stories.length, (index) { + return Padding( + padding: const EdgeInsets.all(3.0), + child: Container( + width: 80, + child: Column( + children: [ + Stack( + children: [ + stories[index]['isStory'] + ? Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + gradient: LinearGradient(colors: bgStoryColors) + ), + child: Padding( + padding: const EdgeInsets.all(2.0), + child: Container( + height: 70, + width: 70, + decoration: BoxDecoration( + shape: BoxShape.circle, + border: Border.all(width: 2, color: bgWhite), + image: DecorationImage( + image: NetworkImage(stories[index]['imageUrl']), + fit: BoxFit.cover + ) + ), + ), + ), + ) + : Padding( + padding: const EdgeInsets.all(2.0), + child: Container( + height: 70, + width: 70, + decoration: BoxDecoration( + shape: BoxShape.circle, + border: Border.all(width: 1, color: bgGrey), + image: DecorationImage( + image: NetworkImage(stories[index]['imageUrl']), + fit: BoxFit.cover + ) + ), + ), + ), + stories[index]['isAdd'] + ? Positioned( + right: 5, + bottom: 0, + child: Container( + height: 20, + width: 20, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: primary + ), + child: Center( + child: Icon(Icons.add, color: bgWhite, size: 20,), + ), + ), + ) + : Container(), + ], + ), + SizedBox(height: 5), + Text( + stories[index]['username'], + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 12 + ), + ), + ], + ), + ), + ); + }) + ), + ), + Divider(), + Column( + children: List.generate(newFeeds.length, (index) { + return Padding( + padding: const EdgeInsets.only(bottom: 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(left: 15, right: 15, bottom: 15), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + gradient: LinearGradient(colors: bgStoryColors), + ), + child: Padding( + padding: const EdgeInsets.all(1.3), + child: Container( + height: 35, + width: 35, + decoration: BoxDecoration( + shape: BoxShape.circle, + border: Border.all(width: 1, color: bgWhite), + image: DecorationImage( + image: NetworkImage(newFeeds[index]['profile']), + fit: BoxFit.cover + ) + ), + ), + ), + ), + SizedBox(width: 10,), + Text( + newFeeds[index]['username'], + style: TextStyle( + fontWeight: FontWeight.bold + ), + ), + ], + ), + Icon(FontAwesome.ellipsis_v, size: 15), + ], + ), + ), + Container( + height: 400, + decoration: BoxDecoration( + image: DecorationImage( + image: NetworkImage(newFeeds[index]['imageUrl']), + fit: BoxFit.cover + ) + ), + ), + Padding( + padding: EdgeInsets.only(left: 8, right: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + IconButton( + splashRadius: 15, + icon: newFeeds[index]['isLike'] ? SvgPicture.asset("assets/images/heart_red.svg", width: 25, height: 25,) : SvgPicture.asset("assets/images/heart.svg", width: 25, height: 25,), + onPressed: () {}, + ), + IconButton( + splashRadius: 15, + icon: Icon(FontAwesome.comment_o, size: 25), + onPressed: () {}, + ), + IconButton( + splashRadius: 15, + icon: SvgPicture.asset("assets/images/share.svg", width: 20, height: 20,), + onPressed: () {}, + ), + ], + ), + IconButton(icon: Icon(Feather.bookmark), onPressed: () {}) + ], + ), + ), + Padding( + padding: EdgeInsets.only(left: 15, right: 15), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '${newFeeds[index]['likes']} likes' , + style: TextStyle(fontWeight: FontWeight.bold), + ), + SizedBox(height: 5), + Text.rich( + TextSpan( + children: [ + TextSpan( + text: newFeeds[index]['username'], + style: TextStyle(fontWeight: FontWeight.bold) + ), + TextSpan(text: newFeeds[index]['caption'], style: TextStyle(height: 1.5)) + ], + ) + ), + SizedBox(height: 8), + Text( + newFeeds[index]['comments'], + style: TextStyle(color: textGrey), + ), + SizedBox(height: 8), + Row( + children: [ + Container( + width: (size.width - 30) * 0.7, + child: Row( + children: [ + Container( + height: 28, + width: 28, + decoration: BoxDecoration( + shape: BoxShape.circle, + border: Border.all(width: 1, color: bgGrey), + image: DecorationImage( + image: NetworkImage(profile), + fit: BoxFit.cover + ) + ), + ), + Container( + height: 25, + width: (size.width - 70) * 0.7, + child: Padding( + padding: EdgeInsets.only(top: 10, left: 10, right: 10), + child: TextField( + cursorColor: textBlack.withOpacity(0.5), + decoration: InputDecoration( + border: InputBorder.none, + hintText: "Add a comment", + hintStyle: TextStyle(fontSize: 14, color: textBlack.withOpacity(0.5)) + ), + ), + ), + ), + ], + ), + ), + Container( + width: (size.width - 30) * 0.3, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Text("🥰"), + SizedBox(width: 8), + Text("😎"), + SizedBox(width: 8), + Icon(Icons.add_circle_outline, size: 20,) + ], + ), + ), + ], + ), + SizedBox(height: 5), + Text( + newFeeds[index]['dateTime'], + style: TextStyle(fontSize: 12, color: textGrey), + ) + ], + ), + ) + ], + ), + ); + }) + ), + ], + ); + } +} \ No newline at end of file diff --git a/lib/pages/new_post_page.dart b/lib/pages/new_post_page.dart new file mode 100644 index 0000000..e81a4fd --- /dev/null +++ b/lib/pages/new_post_page.dart @@ -0,0 +1,15 @@ +import 'package:flutter/material.dart'; + +class NewPostPage extends StatefulWidget { + @override + _NewPostPageState createState() => _NewPostPageState(); +} + +class _NewPostPageState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + body: Center(child: Text("New Post")), + ); + } +} \ No newline at end of file diff --git a/lib/pages/root_app.dart b/lib/pages/root_app.dart new file mode 100644 index 0000000..c19d4d6 --- /dev/null +++ b/lib/pages/root_app.dart @@ -0,0 +1,72 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:instagram_clone/pages/account_page.dart'; +import 'package:instagram_clone/pages/activity_page.dart'; +import 'package:instagram_clone/pages/home_page.dart'; +import 'package:instagram_clone/pages/new_post_page.dart'; +import 'package:instagram_clone/pages/search_page.dart'; +import 'package:instagram_clone/theme/colors.dart'; +import 'package:instagram_clone/util/bottom_navigation_bar_json.dart'; + +class RootApp extends StatefulWidget { + @override + _RootAppState createState() => _RootAppState(); +} + +class _RootAppState extends State { + int indexPage = 0; + + @override + Widget build(BuildContext context) { + return Scaffold( + body: getBody(), + bottomNavigationBar: getBottomNavigationBar(), + ); + } + + Widget getBody() { + return IndexedStack( + index: indexPage, + children: [ + HomePage(), + SearchPage(), + NewPostPage(), + ActivityPage(), + AccountPage(), + ], + ); + } + + Widget getBottomNavigationBar() { + return Container( + height: 70, + decoration: BoxDecoration( + color: bgLightGrey, + border: Border(top: BorderSide(width: 1, color: bgDark.withOpacity(0.3))), + ), + child: Padding( + padding: const EdgeInsets.only(top: 5), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, + children: List.generate(icons.length, (index) { + return IconButton( + onPressed: () { + setState(() { + indexPage = index; + }); + }, + icon: SvgPicture.asset( + indexPage == index + ? icons[index]['active'] + : icons[index]['inactive'], + width: 25, + height: 25, + ), + ); + }) + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/pages/search_page.dart b/lib/pages/search_page.dart new file mode 100644 index 0000000..eb5db3e --- /dev/null +++ b/lib/pages/search_page.dart @@ -0,0 +1,15 @@ + +import 'package:flutter/material.dart'; +class SearchPage extends StatefulWidget { + @override + _SearchPageState createState() => _SearchPageState(); +} + +class _SearchPageState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + body: Center(child: Text("Search")), + ); + } +} \ No newline at end of file diff --git a/lib/screens/favorite_list.dart b/lib/screens/favorite_list.dart new file mode 100644 index 0000000..4e49e67 --- /dev/null +++ b/lib/screens/favorite_list.dart @@ -0,0 +1,65 @@ +import 'dart:math'; + +import 'package:flutter/material.dart'; +import 'package:selfishmachine/model/user.dart'; + +class FavoriteList extends StatelessWidget { + List users = [ + User(name: 'haider sadoonn', phone: "07788099828"), + User(name: 'tyler jhoseph', phone: "07788099828"), + User(name: 'donald trump', phone: "07788099828"), + User(name: 'asap rocky', phone: "07788099828"), + User(name: 'marlene monso', phone: "07788099828"), + User(name: 'kanye west', phone: "07788099828"), + User(name: 'selfishmachine', phone: "07788099828"), + User(name: 'blurryface', phone: "07788099828"), + User(name: 'matt maeson', phone: "07788099828"), + User(name: 'pepopepecheck', phone: "07788099828"), + ]; + + final _random = Random(); + @override + Widget build(BuildContext context) { + return GridView.count( + crossAxisCount: 2, + crossAxisSpacing: 0.5, + mainAxisSpacing: 0.5, + childAspectRatio: 1.1, + children: List.generate( + users.length, + (index) { + return GridTile( + footer: Container( + padding: const EdgeInsets.all(10), + child: Text( + users[index].name, + style: Theme.of(context).textTheme.bodyText1!.copyWith( + color: Colors.white, + ), + ), + ), + child: Card( + elevation: 0.0, + color: Colors.primaries[next(0, 17)], + child: InkWell( + highlightColor: Colors.primaries[next(0, 17)], + onTap: () {}, + child: Center( + child: Text( + users[index].name[0], + style: Theme.of(context) + .textTheme + .headline3! + .copyWith(color: Colors.white70), + ), + ), + ), + ), + ); + }, + ), + ); + } + + int next(int min, int max) => min + _random.nextInt(max - min); +} diff --git a/lib/screens/my_bottom_nav.dart b/lib/screens/my_bottom_nav.dart new file mode 100644 index 0000000..5e50a83 --- /dev/null +++ b/lib/screens/my_bottom_nav.dart @@ -0,0 +1,80 @@ +import 'package:flutter/material.dart'; +import 'package:selfishmachine/screens/favorite_list.dart'; +import 'package:selfishmachine/screens/recent_list.dart'; + +class MyBottomeNav extends StatefulWidget { + @override + State createState() => _MyBottomeNavState(); +} + +class _MyBottomeNavState extends State { + int _currentIndex = 0; + _onTamBottomNavItem(int index) { + setState(() { + _currentIndex = index; + }); + } + + Widget _myBottomNavBar() { + return BottomNavigationBar( + currentIndex: _currentIndex, + fixedColor: Colors.teal, + onTap: _onTamBottomNavItem, + items: [ + BottomNavigationBarItem( + icon: Icon(Icons.star), + title: Text("Favorites"), + ), + BottomNavigationBarItem( + icon: Icon(Icons.access_time), + title: Text("Recents"), + ), + BottomNavigationBarItem( + icon: Icon(Icons.contact_phone), + title: Text("contacts"), + ), + ], + ); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('bottome Nav'), + ), + body: BottomNavContents(index: _currentIndex), + bottomNavigationBar: _myBottomNavBar(), + ); + } +} + +class BottomNavContents extends StatelessWidget { + BottomNavContents({required this.index}); + final int index; + + @override + Widget build(BuildContext context) { + return Container( + child: Center( + child: navBarContents(index, context), + ), + ); + } + + Widget navBarContents(int index, BuildContext context) { + switch (index) { + case 0: + return FavoriteList(); + break; + case 1: + return RecentList(); + break; + case 2: + return RecentList(); + break; + default: + return Container(); + } + } +} diff --git a/lib/screens/recent_list.dart b/lib/screens/recent_list.dart new file mode 100644 index 0000000..5262394 --- /dev/null +++ b/lib/screens/recent_list.dart @@ -0,0 +1,38 @@ +import 'package:flutter/material.dart'; +import 'package:selfishmachine/model/user.dart'; + +class RecentList extends StatelessWidget { + List users = [ + User(name: 'haider sadoonn', phone: "07788099828"), + User(name: 'tyler jhoseph', phone: "07788099828"), + User(name: 'donald trump', phone: "07788099828"), + User(name: 'asap rocky', phone: "07788099828"), + User(name: 'marlene monso', phone: "07788099828"), + User(name: 'kanye west', phone: "07788099828"), + User(name: 'selfishmachine', phone: "07788099828"), + User(name: 'blurryface', phone: "07788099828"), + User(name: 'matt maeson', phone: "07788099828"), + User(name: 'pepopepecheck', phone: "07788099828"), + ]; + @override + Widget build(BuildContext context) { + return ListView.builder( + itemCount: users.length, + itemBuilder: (BuildContext context, int index) { + return ListTile( + leading: CircleAvatar( + child: Text(users[index].name[0]), + ), + trailing: IconButton( + onPressed: () {}, + icon: Icon(Icons.phone), + highlightColor: Colors.teal, + ), + title: Text(users[index].name), + subtitle: Text(users[index].phone), + onTap: () {}, + ); + }, + ); + } +} diff --git a/lib/theme/colors.dart b/lib/theme/colors.dart new file mode 100644 index 0000000..f413992 --- /dev/null +++ b/lib/theme/colors.dart @@ -0,0 +1,28 @@ +import 'package:flutter/material.dart'; + +const Color primary = Color(0xff0095f6); +const Color secondary = Color(0xffffffff); + +const Color textWhite = Color(0xffffffff); +const Color textBlack = Color(0xff000000); +const Color textGrey = Color(0xffC8C8C8); + +const Color bgWhite = Color(0xffffffff); +const Color bgDark = Color(0xff000000); +const Color bgGrey = Color(0xffC8C8C8); +const Color bgLightGrey = Color(0xffFAFAFA); + +const bgStoryColors = [ + const Color(0xffA844A1), + const Color(0xffAB429A), + const Color(0xffB43C88), + const Color(0xffC33269), + const Color(0xffD7243F), + const Color(0xffF9A326), + const Color(0xffF9DD26), +]; + +const Color success = Color(0xff44c93a); +const Color danger = Color(0xffff4657); +const Color info = Color(0xff5bc0de); +const Color warning = Color(0xfffeba06); diff --git a/lib/util/account_images_json.dart b/lib/util/account_images_json.dart new file mode 100644 index 0000000..7900ca6 --- /dev/null +++ b/lib/util/account_images_json.dart @@ -0,0 +1,10 @@ +const images = [ + "https://images.unsplash.com/photo-1470613043660-69a0cfd9f1dc?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1170&q=80", + "https://i.redd.it/jzlhkkwimrx21.jpg", + "https://static2.srcdn.com/wordpress/wp-content/uploads/2020/10/Bloodborne-Moon-Ending.jpg?q=50&fit=crop&w=960&h=500&dpr=1.5", + "https://static1.srcdn.com/wordpress/wp-content/uploads/2020/10/Bloodborne-Honoring-Wishes-Doll-Hunter.jpg?q=50&fit=crop&w=740&h=369&dpr=1.5", + "https://cdn.gamer-network.net/2018/usgamer/bloodborne-micolash.jpg/EG11/resize/656x-1/quality/70", + "https://cdn.gamer-network.net/2018/usgamer/bloodborne-mensis-cage.jpg/EG11/resize/656x-1/quality/70", +]; + +const imageWithTags = []; diff --git a/lib/util/bottom_navigation_bar_json.dart b/lib/util/bottom_navigation_bar_json.dart new file mode 100644 index 0000000..3988774 --- /dev/null +++ b/lib/util/bottom_navigation_bar_json.dart @@ -0,0 +1,23 @@ + +const icons = [ + { + "inactive": "assets/images/home.svg", + "active": "assets/images/home_active.svg", + }, + { + "inactive": "assets/images/search.svg", + "active": "assets/images/search_active.svg", + }, + { + "inactive": "assets/images/add.svg", + "active": "assets/images/add_active.svg", + }, + { + "inactive": "assets/images/heart.svg", + "active": "assets/images/heart_active.svg", + }, + { + "inactive": "assets/images/account.svg", + "active": "assets/images/account_active.svg", + }, +]; \ No newline at end of file diff --git a/lib/util/chat_detail_json.dart b/lib/util/chat_detail_json.dart new file mode 100644 index 0000000..2ed9908 --- /dev/null +++ b/lib/util/chat_detail_json.dart @@ -0,0 +1,101 @@ + +const chatDetails = [ + { + "id": 1, + "isMe": false, + "profile": "https://i.pinimg.com/originals/cd/63/95/cd63958613ce86afc242b1bcc5812bba.jpg", + "message": "Hey mate!", + "messageNo": 1, + }, + { + "id": 2, + "isMe": false, + "profile": "https://i.pinimg.com/originals/cd/63/95/cd63958613ce86afc242b1bcc5812bba.jpg", + "message": "How are you doing?", + "messageNo": 3, + }, + { + "id": 3, + "isMe": true, + "profile": "", + "message": "Hi!", + "messageNo": 1, + }, + { + "id": 4, + "isMe": true, + "profile": "", + "message": "Fine.", + "messageNo": 2, + }, + { + "id": 5, + "isMe": true, + "profile": "", + "message": "Tngai mon khernh u tv aeon2", + "messageNo": 3, + }, + { + "id": 6, + "isMe": false, + "profile": "https://i.pinimg.com/originals/cd/63/95/cd63958613ce86afc242b1bcc5812bba.jpg", + "message": "Nhuii mix min hav pg", + "messageNo": 0, + }, + { + "id": 6, + "isMe": true, + "profile": "", + "message": "Eng hav ter tae yg tver min lir ey na", + "messageNo": 1, + }, + { + "id": 6, + "isMe": true, + "profile": "", + "message": "😒😒😒", + "messageNo": 3, + }, + { + "id": 7, + "isMe": false, + "profile": "https://i.pinimg.com/originals/cd/63/95/cd63958613ce86afc242b1bcc5812bba.jpg", + "message": "Tv oy ke somtos", + "messageNo": 1, + }, + { + "id": 8, + "isMe": false, + "profile": "https://i.pinimg.com/originals/cd/63/95/cd63958613ce86afc242b1bcc5812bba.jpg", + "message": "Lv nv na c ey ot?", + "messageNo": 3, + }, + { + "id": 9, + "isMe": true, + "profile": "", + "message": "Tos", + "messageNo": 1, + }, + { + "id": 10, + "isMe": true, + "profile": "", + "message": "C nv na?", + "messageNo": 3, + }, + { + "id": 11, + "isMe": false, + "profile": "https://i.pinimg.com/originals/cd/63/95/cd63958613ce86afc242b1bcc5812bba.jpg", + "message": "Bunchon IFL?", + "messageNo": 0, + }, + { + "id": 12, + "isMe": true, + "profile": "", + "message": "Okay", + "messageNo": 0, + }, +]; \ No newline at end of file diff --git a/lib/util/chat_json.dart b/lib/util/chat_json.dart new file mode 100644 index 0000000..07962a6 --- /dev/null +++ b/lib/util/chat_json.dart @@ -0,0 +1,18 @@ +const chats = [ + { + "id": 1, + "profile": + "https://static.wikia.nocookie.net/bloodborne/images/f/f4/Bloodborne%E2%84%A2_20151207230637.png/revision/latest/scale-to-width-down/1000?cb=20151207210723", + "username": "lady maria", + "description": "Active", + "dateTime": "now" + }, + { + "id": 2, + "profile": + "https://static.wikia.nocookie.net/villains/images/8/88/Gehrman_Chair_Bloodborne_1.png/revision/latest?cb=20160507163457", + "username": "gehrman", + "description": "Active", + "dateTime": "2h ago" + }, +]; diff --git a/lib/util/constant.dart b/lib/util/constant.dart new file mode 100644 index 0000000..7058d24 --- /dev/null +++ b/lib/util/constant.dart @@ -0,0 +1,5 @@ +const String profile = "https://pbs.twimg.com/media/En0GpgZXIAA2Y3R.jpg"; +const String username = "Selfishmachine"; + +const String instagramName = "Haider sadoon"; +const String instagramBio = "welcome home good hunter"; diff --git a/lib/util/new_feed_json.dart b/lib/util/new_feed_json.dart new file mode 100644 index 0000000..e5e6693 --- /dev/null +++ b/lib/util/new_feed_json.dart @@ -0,0 +1,104 @@ +const newFeeds = [ + { + "id": 1, + "profile": + "https://i.pinimg.com/564x/53/5b/cc/535bcc83888cc05b2c9eb5364a710721.jpg", + "username": "blurryface", + "imageUrl": + "https://i.pinimg.com/564x/7d/90/e9/7d90e9e84781b6a92bc89814f0025c14.jpg", + "likes": "4,713,639", + "isLike": true, + "caption": " ;", + "comments": "View all 17,792 comments", + "dateTime": "3 days ago" + }, + { + "id": 2, + "profile": + "https://discover.ticketmaster.co.uk/wp-content/uploads/2018/08/TOP-CompleteDiversion-738x415.jpg.webp", + "username": "trench", + "imageUrl": + "https://i.pinimg.com/564x/ec/4b/7d/ec4b7d8f9091f9cd530ce96244773caa.jpg", + "likes": "127,805", + "isLike": true, + "caption": " *,🏖", + "comments": "View all 93 comments", + "dateTime": "7 hours ago" + }, + { + "id": 3, + "profile": + "https://bloodborne.wiki.fextralife.com/file/Bloodborne/Gehrman%20Close-up.jpg", + "username": "gehrman", + "imageUrl": "https://cdn.gamer-network.net/2015/usgamer/bb_bryan_5.jpg", + "likes": "331,224", + "isLike": true, + "caption": "tonight gehrman joins the hunt ;) i will back soon ", + "comments": "View all 230 comments", + "dateTime": "4 days ago" + }, + { + "id": 4, + "profile": + "http://3.bp.blogspot.com/-JK03NHzPE3k/UfFWYChQ4OI/AAAAAAAAMeQ/iqYDFe78ytQ/s1600/PTV_July13_340.jpg", + "username": "selfishmachine", + "imageUrl": + "https://upload.wikimedia.org/wikipedia/en/7/78/Selfish_Machines.jpg", + "likes": "126,113", + "isLike": false, + "caption": " check our best albume", + "comments": "View all 184 comments", + "dateTime": "14 hours ago" + }, + { + "id": 5, + "profile": + "https://2.bp.blogspot.com/-RABq3Z92hzA/W8NClLyZ8TI/AAAAAAAAcDo/9DFr5KhhjuYAUODmaKKn6-BVoHlxnajbwCLcBGAs/s1600/Bloodborne%25E2%2584%25A2_20181010142738_1.png", + "username": "gascoigne", + "imageUrl": + "https://static.wikia.nocookie.net/bloodborne/images/4/42/Bloodborne%E2%84%A2_The_Old_Hunters_Edition_20160308202701e.jpg/revision/latest/scale-to-width-down/1000?cb=20161027065036", + "likes": "8,956", + "isLike": true, + "caption": " he made me show him my true face ;)", + "comments": "View all 6 comments", + "dateTime": "8 hours ago" + }, + { + "id": 6, + "profile": + "https://static.wikia.nocookie.net/bloodborne/images/4/40/Bloodborne%E2%84%A2_20151125212446.jpg/revision/latest/scale-to-width-down/1000?cb=20151126073241", + "username": "lady maria", + "imageUrl": + "https://static.wikia.nocookie.net/bloodborne/images/f/f4/Bloodborne%E2%84%A2_20151207230637.png/revision/latest/scale-to-width-down/1000?cb=20151207210723", + "likes": "14,182", + "isLike": false, + "caption": " i feel hot asf", + "comments": "View all 143 comments", + "dateTime": "21 hours ago" + }, + { + "id": 7, + "profile": + "https://4.bp.blogspot.com/-_drXfyXFviA/XL7VNf1mudI/AAAAAAAAdu8/5adY_9mCYMM39v7D_FeOKn17C2LetKg_wCLcBGAs/s1600/Bloodborne%25E2%2584%25A2_20190420092056.png", + "username": "micolash", + "imageUrl": + "https://1.bp.blogspot.com/-LbJlOa7ocqs/W28s43B5NoI/AAAAAAAAau4/20KWjJdqmDY718QWQU8d8KL4PFmfuQBSgCLcBGAs/s488/Bloodborne%25E2%2584%25A2_20180721193228.png", + "likes": "131,148", + "isLike": false, + "caption": " selfie time don't ask why i ware this cage", + "comments": "View all 533 comments", + "dateTime": "5 hours ago" + }, + { + "id": 8, + "profile": "https://i.redd.it/jzlhkkwimrx21.jpg", + "username": "jean", + "imageUrl": + "https://bloodborne.wiki.fextralife.com/file/Bloodborne/bbend_sunrise.jpg", + "likes": "3,413", + "isLike": false, + "caption": " oh shit i regrat this", + "comments": "View all 17,792 comments", + "dateTime": "6 hours ago" + }, +]; diff --git a/lib/util/story_json.dart b/lib/util/story_json.dart new file mode 100644 index 0000000..cdad606 --- /dev/null +++ b/lib/util/story_json.dart @@ -0,0 +1,66 @@ +const stories = [ + { + "id": 1, + "imageUrl": "", + "username": "yone", + "isStory": false, + "isAdd": true + }, + { + "id": 2, + "imageUrl": "", + "username": "senna", + "isStory": true, + "isAdd": false + }, + {"id": 3, "imageUrl": "", "username": "lux", "isStory": true, "isAdd": false}, + { + "id": 4, + "imageUrl": "", + "username": "velkoz", + "isStory": true, + "isAdd": false + }, + { + "id": 5, + "imageUrl": "", + "username": "atrox", + "isStory": true, + "isAdd": false + }, + { + "id": 6, + "imageUrl": "", + "username": "jinx", + "isStory": true, + "isAdd": false + }, + { + "id": 7, + "imageUrl": "", + "username": "jhin", + "isStory": true, + "isAdd": false + }, + // { + // "id": 8, + // "imageUrl": "https://instagram.fpnh5-1.fna.fbcdn.net/v/t51.2885-19/s320x320/120911233_113942167015019_7757793538086741578_n.jpg?_nc_ht=instagram.fpnh5-1.fna.fbcdn.net&_nc_ohc=IJPd5-1dI0gAX-cLOnZ&tp=1&oh=3f71b1d6872a5816343adba38cc86ac1&oe=602B1741", + // "username": "roses_are_rosie", + // "isStory": true, + // "isAdd": false + // }, + // { + // "id": 9, + // "imageUrl": "https://instagram.fpnh5-1.fna.fbcdn.net/v/t51.2885-19/s150x150/79759650_2634433480008375_7190676118599368704_n.jpg?_nc_ht=instagram.fpnh5-1.fna.fbcdn.net&_nc_ohc=l8J5w3gAuXMAX8FgKFX&tp=1&oh=d2556ab8c3a33b7347d98dad6a86ac51&oe=602BCC61", + // "username": "mookworranit", + // "isStory": true, + // "isAdd": false + // }, + // { + // "id": 10, + // "imageUrl": "https://instagram.fpnh5-1.fna.fbcdn.net/v/t51.2885-19/s150x150/120063925_828927407644150_6438190445499231487_n.jpg?_nc_ht=instagram.fpnh5-1.fna.fbcdn.net&_nc_ohc=dKhiJvCyAoQAX8c0XhM&tp=1&oh=47a1cd347fafe80e978b67d85674f33c&oe=602C5C58", + // "username": "minashe___", + // "isStory": true, + // "isAdd": false + // }, +]; diff --git a/task3/assets/rainy.png b/task3/assets/rainy.png new file mode 100644 index 0000000..9f9a71a Binary files /dev/null and b/task3/assets/rainy.png differ diff --git a/task3/assets/rainy_2d.png b/task3/assets/rainy_2d.png new file mode 100644 index 0000000..50b2cbc Binary files /dev/null and b/task3/assets/rainy_2d.png differ diff --git a/task3/assets/snow.png b/task3/assets/snow.png new file mode 100644 index 0000000..2045af3 Binary files /dev/null and b/task3/assets/snow.png differ diff --git a/task3/assets/snow_2d.png b/task3/assets/snow_2d.png new file mode 100644 index 0000000..7fcf9ab Binary files /dev/null and b/task3/assets/snow_2d.png differ diff --git a/task3/assets/sunny.png b/task3/assets/sunny.png new file mode 100644 index 0000000..e3f0cbe Binary files /dev/null and b/task3/assets/sunny.png differ diff --git a/task3/assets/sunny_2d.png b/task3/assets/sunny_2d.png new file mode 100644 index 0000000..c68301b Binary files /dev/null and b/task3/assets/sunny_2d.png differ diff --git a/task3/assets/thunder.png b/task3/assets/thunder.png new file mode 100644 index 0000000..14af187 Binary files /dev/null and b/task3/assets/thunder.png differ diff --git a/task3/assets/thunder_2d.png b/task3/assets/thunder_2d.png new file mode 100644 index 0000000..26a8091 Binary files /dev/null and b/task3/assets/thunder_2d.png differ diff --git a/task3/lib/dataset.dart b/task3/lib/dataset.dart new file mode 100644 index 0000000..0344d4e --- /dev/null +++ b/task3/lib/dataset.dart @@ -0,0 +1,94 @@ +class Weather { + final int max; + final int min; + final int current; + final String name; + final String day; + final int wind; + final int humidity; + final int chanceRain; + final String image; + final String time; + final String location; + + Weather( + {this.max, + this.min, + this.name, + this.day, + this.wind, + this.humidity, + this.chanceRain, + this.image, + this.current, + this.time, + this.location}); +} + +List todayWeather = [ + Weather(current: 23, image: "assets/rainy_2d.png", time: "10:00"), + Weather(current: 21, image: "assets/thunder_2d.png", time: "11:00"), + Weather(current: 22, image: "assets/rainy_2d.png", time: "12:00"), + Weather(current: 19, image: "assets/snow_2d.png", time: "01:00") +]; + +Weather currentTemp = Weather( + current: 21, + image: "assets/thunder.png", + name: "Thunderstorm", + day: "Monday, 17 May", + wind: 13, + humidity: 24, + chanceRain: 87, + location: "baghdad"); + +Weather tomorrowTemp = Weather( + max: 20, + min: 17, + image: "assets/sunny.png", + name: "Sunny", + wind: 9, + humidity: 31, + chanceRain: 20, +); + +List sevenDay = [ + Weather( + max: 20, + min: 14, + image: "assets/rainy_2d.png", + day: "Mon", + name: "Rainy"), + Weather( + max: 22, + min: 16, + image: "assets/thunder_2d.png", + day: "Tue", + name: "Thunder"), + Weather( + max: 19, + min: 13, + image: "assets/rainy_2d.png", + day: "Wed", + name: "Rainy"), + Weather( + max: 18, min: 12, image: "assets/snow_2d.png", day: "Thu", name: "Snow"), + Weather( + max: 23, + min: 19, + image: "assets/sunny_2d.png", + day: "Fri", + name: "Sunny"), + Weather( + max: 25, + min: 17, + image: "assets/rainy_2d.png", + day: "Sat", + name: "Rainy"), + Weather( + max: 21, + min: 18, + image: "assets/thunder_2d.png", + day: "Sun", + name: "Thunder") +]; diff --git a/task3/lib/detailPage.dart b/task3/lib/detailPage.dart new file mode 100644 index 0000000..3c2648e --- /dev/null +++ b/task3/lib/detailPage.dart @@ -0,0 +1,184 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_glow/flutter_glow.dart'; +import 'package:weather_tutorial/dataset.dart'; +import 'package:weather_tutorial/extraWeather.dart'; + +class DetailPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Color(0xff030317), + body: Column( + children: [TomorrowWeather(), SevenDays()], + ), + ); + } +} + +class TomorrowWeather extends StatelessWidget { + @override + Widget build(BuildContext context) { + return GlowContainer( + color: Color(0xff00A1FF), + glowColor: Color(0xff00A1FF), + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(60), bottomRight: Radius.circular(60)), + child: Column( + children: [ + Padding( + padding: EdgeInsets.only(top: 50, right: 30, left: 30, bottom: 20), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + GestureDetector( + onTap: () { + Navigator.pop(context); + }, + child: Icon( + Icons.arrow_back_ios, + color: Colors.white, + )), + Row( + children: [ + Icon( + Icons.calendar_today, + color: Colors.white, + ), + Text( + " 7 days", + style: + TextStyle(fontSize: 25, fontWeight: FontWeight.bold), + ) + ], + ), + Icon(Icons.more_vert, color: Colors.white) + ], + ), + ), + Padding( + padding: EdgeInsets.all(8), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + width: MediaQuery.of(context).size.width / 2.3, + height: MediaQuery.of(context).size.width / 2.3, + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage(tomorrowTemp.image))), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + "Tomorrow", + style: TextStyle(fontSize: 30, height: 0.1), + ), + Container( + height: 105, + child: Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + GlowText( + tomorrowTemp.max.toString(), + style: TextStyle( + fontSize: 100, fontWeight: FontWeight.bold), + ), + Text( + "/" + tomorrowTemp.min.toString() + "\u00B0", + style: TextStyle( + color: Colors.black54.withOpacity(0.3), + fontSize: 40, + fontWeight: FontWeight.bold), + ), + ], + ), + ), + SizedBox( + height: 10, + ), + Text( + " " + tomorrowTemp.name, + style: TextStyle( + fontSize: 15, + ), + ) + ], + ) + ], + ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 20, + right: 50, + left: 50, + ), + child: Column( + children: [ + Divider(color: Colors.white), + SizedBox( + height: 10, + ), + ExtraWeather(tomorrowTemp) + ], + ), + ) + ], + ), + ); + } +} + +class SevenDays extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Expanded( + child: ListView.builder( + itemCount: sevenDay.length, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.only(left: 20, right: 20, bottom: 25), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text(sevenDay[index].day, style: TextStyle(fontSize: 20)), + Container( + width: 135, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Image( + image: AssetImage(sevenDay[index].image), + width: 40, + ), + SizedBox(width: 15), + Text( + sevenDay[index].name, + style: TextStyle(fontSize: 20), + ) + ], + ), + ), + Row( + children: [ + Text( + "+" + sevenDay[index].max.toString() + "\u00B0", + style: TextStyle(fontSize: 20), + ), + SizedBox( + width: 5, + ), + Text( + "+" + sevenDay[index].min.toString() + "\u00B0", + style: TextStyle(fontSize: 20, color: Colors.grey), + ), + ], + ) + ], + )); + }), + ); + } +} diff --git a/task3/lib/extraWeather.dart b/task3/lib/extraWeather.dart new file mode 100644 index 0000000..c97a6e6 --- /dev/null +++ b/task3/lib/extraWeather.dart @@ -0,0 +1,83 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:weather_tutorial/dataset.dart'; + +class ExtraWeather extends StatelessWidget { + final Weather temp; + ExtraWeather(this.temp); + + @override + Widget build(BuildContext context) { + return Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Column( + children: [ + Icon( + CupertinoIcons.wind, + color: Colors.white, + ), + SizedBox( + height: 10, + ), + Text( + temp.wind.toString() + " Km/h", + style: TextStyle(fontWeight: FontWeight.w700, fontSize: 16), + ), + SizedBox( + height: 10, + ), + Text( + "Wind", + style: TextStyle(color: Colors.black54, fontSize: 16), + ) + ], + ), + Column( + children: [ + Icon( + CupertinoIcons.wind, + color: Colors.white, + ), + SizedBox( + height: 10, + ), + Text( + temp.humidity.toString() + " %", + style: TextStyle(fontWeight: FontWeight.w700, fontSize: 16), + ), + SizedBox( + height: 10, + ), + Text( + "Humidity", + style: TextStyle(color: Colors.black54, fontSize: 16), + ) + ], + ), + Column( + children: [ + Icon( + CupertinoIcons.wind, + color: Colors.white, + ), + SizedBox( + height: 10, + ), + Text( + temp.chanceRain.toString() + " %", + style: TextStyle(fontWeight: FontWeight.w700, fontSize: 16), + ), + SizedBox( + height: 10, + ), + Text( + "Rain", + style: TextStyle(color: Colors.black54, fontSize: 16), + ) + ], + ) + ], + ); + } +} diff --git a/task3/lib/homePage.dart b/task3/lib/homePage.dart new file mode 100644 index 0000000..c4131d2 --- /dev/null +++ b/task3/lib/homePage.dart @@ -0,0 +1,207 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_glow/flutter_glow.dart'; +import 'package:weather_tutorial/dataset.dart'; +import 'package:weather_tutorial/detailPage.dart'; +import 'package:weather_tutorial/extraWeather.dart'; + +class HomePage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Color(0xff030317), + body: Column( + children: [CurrentWeather(), TodayWeather()], + ), + ); + } +} + +class CurrentWeather extends StatelessWidget { + @override + Widget build(BuildContext context) { + return GlowContainer( + height: MediaQuery.of(context).size.height - 230, + margin: EdgeInsets.all(2), + padding: EdgeInsets.only(top: 50, left: 30, right: 30), + glowColor: Color(0xff00A1FF).withOpacity(0.5), + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(60), bottomRight: Radius.circular(60)), + color: Color(0xff00A1FF), + spreadRadius: 5, + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Icon( + CupertinoIcons.square_grid_2x2, + color: Colors.white, + ), + Row( + children: [ + Icon(CupertinoIcons.map_fill, color: Colors.white), + Text( + " " + currentTemp.location, + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30), + ), + ], + ), + Icon(Icons.more_vert, color: Colors.white) + ], + ), + Container( + margin: EdgeInsets.only(top: 10), + padding: EdgeInsets.all(10), + decoration: BoxDecoration( + border: Border.all(width: 0.2, color: Colors.white), + borderRadius: BorderRadius.circular(30)), + child: Text( + "Updating", + style: TextStyle(fontWeight: FontWeight.bold), + ), + ), + Container( + height: 430, + child: Stack( + children: [ + Image( + image: AssetImage(currentTemp.image), + fit: BoxFit.fill, + ), + Positioned( + bottom: 0, + right: 0, + left: 0, + child: Center( + child: Column( + children: [ + GlowText( + currentTemp.current.toString(), + style: TextStyle( + height: 0.1, + fontSize: 150, + fontWeight: FontWeight.bold), + ), + Text(currentTemp.name, + style: TextStyle( + fontSize: 25, + )), + Text(currentTemp.day, + style: TextStyle( + fontSize: 18, + )) + ], + )), + ) + ], + ), + ), + Divider( + color: Colors.white, + ), + SizedBox( + height: 10, + ), + ExtraWeather(currentTemp) + ], + ), + ); + } +} + +class TodayWeather extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Padding( + padding: EdgeInsets.only(left: 30, right: 30, top: 10), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "Today", + style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold), + ), + GestureDetector( + onTap: () { + Navigator.push(context, + MaterialPageRoute(builder: (BuildContext context) { + return DetailPage(); + })); + }, + child: Row( + children: [ + Text( + "7 days ", + style: TextStyle(fontSize: 18, color: Colors.grey), + ), + Icon( + Icons.arrow_forward_ios_outlined, + color: Colors.grey, + size: 15, + ) + ], + ), + ) + ], + ), + SizedBox( + height: 15, + ), + Container( + margin: EdgeInsets.only( + bottom: 30, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + WeatherWidget(todayWeather[0]), + WeatherWidget(todayWeather[1]), + WeatherWidget(todayWeather[2]), + WeatherWidget(todayWeather[3]) + ]), + ) + ], + ), + ); + } +} + +class WeatherWidget extends StatelessWidget { + final Weather weather; + WeatherWidget(this.weather); + @override + Widget build(BuildContext context) { + return Container( + padding: EdgeInsets.all(15), + decoration: BoxDecoration( + border: Border.all(width: 0.2, color: Colors.white), + borderRadius: BorderRadius.circular(35)), + child: Column( + children: [ + Text( + weather.current.toString() + "\u00B0", + style: TextStyle(fontSize: 20), + ), + SizedBox( + height: 5, + ), + Image( + image: AssetImage(weather.image), + width: 50, + height: 50, + ), + SizedBox( + height: 5, + ), + Text( + weather.time, + style: TextStyle(fontSize: 16, color: Colors.grey), + ) + ], + ), + ); + } +} diff --git a/task3/lib/main.dart b/task3/lib/main.dart new file mode 100644 index 0000000..311d666 --- /dev/null +++ b/task3/lib/main.dart @@ -0,0 +1,22 @@ +import 'package:flutter/material.dart'; +import 'package:weather_tutorial/homePage.dart'; + +void main() { + runApp(MyApp()); +} + +class MyApp extends StatelessWidget { + // This widget is the root of your application. + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Weather', + theme: ThemeData( + textTheme: Theme.of(context) + .textTheme + .apply(bodyColor: Colors.white, displayColor: Colors.blue)), + debugShowCheckedModeBanner: false, + home: HomePage(), + ); + } +} diff --git a/task3/pubspec.yaml b/task3/pubspec.yaml new file mode 100644 index 0000000..345d8a1 --- /dev/null +++ b/task3/pubspec.yaml @@ -0,0 +1,76 @@ +name: weather_tutorial +description: A new Flutter project. + +# The following line prevents the package from being accidentally published to +# pub.dev using `pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +version: 1.0.0+1 + +environment: + sdk: ">=2.7.0 <3.0.0" + +dependencies: + flutter: + sdk: flutter + + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.2 + flutter_glow: ^0.2.0 + +dev_dependencies: + flutter_test: + sdk: flutter + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + assets: + - assets/ + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware. + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/assets-and-images/#from-packages + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/custom-fonts/#from-packages diff --git a/task3/selfishmachine b/task3/selfishmachine new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/task3/selfishmachine @@ -0,0 +1 @@ +