diff --git a/assiets/images/add_icon.png b/assiets/images/add_icon.png new file mode 100644 index 0000000..3f4fc07 Binary files /dev/null and b/assiets/images/add_icon.png differ diff --git a/assiets/images/back_arrow_icon.png b/assiets/images/back_arrow_icon.png new file mode 100644 index 0000000..894301b Binary files /dev/null and b/assiets/images/back_arrow_icon.png differ diff --git a/assiets/images/check_icon.png b/assiets/images/check_icon.png new file mode 100644 index 0000000..4ecbf66 Binary files /dev/null and b/assiets/images/check_icon.png differ diff --git a/assiets/images/delete_icon.png b/assiets/images/delete_icon.png new file mode 100644 index 0000000..560ce63 Binary files /dev/null and b/assiets/images/delete_icon.png differ diff --git a/assiets/images/logo.png b/assiets/images/logo.png new file mode 100644 index 0000000..68ffae1 Binary files /dev/null and b/assiets/images/logo.png differ diff --git a/images/1.jpg b/images/1.jpg new file mode 100644 index 0000000..a38fc8b Binary files /dev/null and b/images/1.jpg differ diff --git a/images/2.png b/images/2.png new file mode 100644 index 0000000..88327e2 Binary files /dev/null and b/images/2.png differ diff --git a/images/3.png b/images/3.png new file mode 100644 index 0000000..29b6b96 Binary files /dev/null and b/images/3.png differ diff --git a/images/4.png b/images/4.png new file mode 100644 index 0000000..49444b3 Binary files /dev/null and b/images/4.png differ diff --git a/images/5.png b/images/5.png new file mode 100644 index 0000000..cfeb843 Binary files /dev/null and b/images/5.png differ diff --git a/images/6.png b/images/6.png new file mode 100644 index 0000000..b1f8e8a Binary files /dev/null and b/images/6.png differ diff --git a/images/7.png b/images/7.png new file mode 100644 index 0000000..98235e9 Binary files /dev/null and b/images/7.png differ diff --git a/images/8.png b/images/8.png new file mode 100644 index 0000000..3e9cc00 Binary files /dev/null and b/images/8.png differ diff --git a/images/insta_logo.jpg b/images/insta_logo.jpg new file mode 100644 index 0000000..f4bb6cf Binary files /dev/null and b/images/insta_logo.jpg differ diff --git a/images/insta_title.png b/images/insta_title.png new file mode 100644 index 0000000..b62add3 Binary files /dev/null and b/images/insta_title.png differ diff --git a/images/post_1.jfif b/images/post_1.jfif new file mode 100644 index 0000000..a3895f4 Binary files /dev/null and b/images/post_1.jfif differ diff --git a/images/post_10.jpg b/images/post_10.jpg new file mode 100644 index 0000000..dbc22a2 Binary files /dev/null and b/images/post_10.jpg differ diff --git a/images/post_11.jpg b/images/post_11.jpg new file mode 100644 index 0000000..b9c1d87 Binary files /dev/null and b/images/post_11.jpg differ diff --git a/images/post_12.jfif b/images/post_12.jfif new file mode 100644 index 0000000..b7cde56 Binary files /dev/null and b/images/post_12.jfif differ diff --git a/images/post_2.jfif b/images/post_2.jfif new file mode 100644 index 0000000..2c068bf Binary files /dev/null and b/images/post_2.jfif differ diff --git a/images/post_3.jfif b/images/post_3.jfif new file mode 100644 index 0000000..97be4aa Binary files /dev/null and b/images/post_3.jfif differ diff --git a/images/post_4.jpg b/images/post_4.jpg new file mode 100644 index 0000000..dc138c3 Binary files /dev/null and b/images/post_4.jpg differ diff --git a/images/post_5.jfif b/images/post_5.jfif new file mode 100644 index 0000000..bde8577 Binary files /dev/null and b/images/post_5.jfif differ diff --git a/images/post_6.jpg b/images/post_6.jpg new file mode 100644 index 0000000..a8e8e03 Binary files /dev/null and b/images/post_6.jpg differ diff --git a/images/post_7.jfif b/images/post_7.jfif new file mode 100644 index 0000000..b2df1e2 Binary files /dev/null and b/images/post_7.jfif differ diff --git a/images/post_8.jpg b/images/post_8.jpg new file mode 100644 index 0000000..3e21be3 Binary files /dev/null and b/images/post_8.jpg differ diff --git a/images/post_9jpg.jpg b/images/post_9jpg.jpg new file mode 100644 index 0000000..6267a75 Binary files /dev/null and b/images/post_9jpg.jpg differ diff --git a/images/storybackground.jpg b/images/storybackground.jpg new file mode 100644 index 0000000..ec6bfa2 Binary files /dev/null and b/images/storybackground.jpg differ diff --git a/lib/main.dart b/lib/main.dart index 2c084ed..1bbd2d6 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'dart:math' as math; + void main() { runApp(const MyApp()); } @@ -42,7 +43,7 @@ class MyHomePage extends StatefulWidget { class _MyHomePageState extends State { int _selectedIndex = 2; static const TextStyle optionStyle = - TextStyle(fontSize: 30, fontWeight: FontWeight.bold); + TextStyle(fontSize: 30, fontWeight: FontWeight.bold); static late List _pages; _MyHomePageState() { @@ -142,13 +143,16 @@ class _MyHomePageState extends State { return Column( children: [ Text('Favorites'), - Divider(thickness: 4,), + 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); + var personColor = + Color((math.Random().nextDouble() * 0xFFFFFF).toInt()) + .withOpacity(1.0); return Center( child: Container( width: 120, @@ -159,7 +163,7 @@ class _MyHomePageState extends State { ), alignment: Alignment.center, decoration: - BoxDecoration(shape: BoxShape.circle, color: personColor), + BoxDecoration(shape: BoxShape.circle, color: personColor), ), ); }), @@ -243,8 +247,7 @@ class _MyHomePageState extends State { BottomNavigationBarItem( icon: Icon(Icons.access_time_outlined), label: 'School', - activeIcon: Icon(Icons.access_time_filled) - ), + activeIcon: Icon(Icons.access_time_filled)), ], currentIndex: _selectedIndex, selectedItemColor: Colors.amber[800], diff --git a/lib/task_1/home_page.dart b/lib/task_1/home_page.dart new file mode 100644 index 0000000..b3ad461 --- /dev/null +++ b/lib/task_1/home_page.dart @@ -0,0 +1,199 @@ +import 'package:flutter/material.dart'; + +class HomePage extends StatefulWidget { + @override + _HomePageState createState() => _HomePageState(); +} + +class _HomePageState extends State { + List profileImages = [ + "images/1.jpg", + "images/2.png", + "images/3.png", + "images/4.png", + "images/5.png", + "images/6.png", + "images/7.png", + "images/8.png", + ]; + List posts = [ + "images/post_1.jfif", + "images/post_2.jfif", + "images/post_3.jfif", + "images/post_4.jpg", + "images/post_5.jfif", + "images/post_6.jpg", + "images/post_7.jfif", + "images/post_8.jpg", + ]; + Future onRefresh() async { + await Future.delayed(Duration(seconds: 1)); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Image.asset( + "images/insta_title.png", + height: 50, + ), + actions: [ + IconButton(onPressed: () {}, icon: Icon(Icons.add_circle_outline)), + IconButton(onPressed: () {}, icon: Icon(Icons.favorite_border)), + IconButton(onPressed: () {}, icon: Icon(Icons.chat_bubble_outline)) + ], + ), + body: RefreshIndicator( + onRefresh: onRefresh, + child: SingleChildScrollView( + child: Column( + children: [ + SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row( + children: List.generate( + 8, + (index) => Container( + padding: EdgeInsets.all(10), + child: Column( + children: [ + CircleAvatar( + radius: 35, + backgroundImage: + AssetImage("images/storybackground.png"), + child: CircleAvatar( + radius: 32, + backgroundImage: AssetImage(profileImages[index]), + ), + ), + SizedBox(height: 10), + Text( + "Profile Name", + style: TextStyle(fontSize: 12, color: Colors.black87), + ) + ], + ), + ), + ), + ), + ), + Divider(), + Column( + children: List.generate( + 8, + (index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // post + Row( + children: [ + Container( + padding: EdgeInsets.all(10), + child: CircleAvatar( + radius: 14, + backgroundImage: + AssetImage("images/storybackground.png"), + child: CircleAvatar( + radius: 12, + backgroundImage: AssetImage(profileImages[index]), + ), + ), + ), + Text("profile name"), + Spacer(), + IconButton( + onPressed: () {}, + icon: Icon(Icons.more_vert), + ) + ], + ), + //Image po + Image.asset(posts[index], + height: 300, + width: double.maxFinite, + fit: BoxFit.cover), + + Row( + children: [ + IconButton( + icon: Icon(Icons.favorite_border), + onPressed: () {}, + ), + IconButton( + icon: Icon(Icons.chat_bubble_outline), + onPressed: () {}, + ), + IconButton( + icon: Icon(Icons.label_outline), + onPressed: () {}, + ), + Spacer(), + IconButton( + icon: Icon(Icons.bookmark_border), + onPressed: () {}, + ), + ], + ), + Container( + padding: EdgeInsets.all(15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + RichText( + text: TextSpan( + style: TextStyle(color: Colors.black), + children: [ + TextSpan(text: "Liked by"), + TextSpan( + text: " profile Name", + style: TextStyle( + fontWeight: FontWeight.bold, + ), + ), + TextSpan(text: " and"), + TextSpan( + text: " others", + style: TextStyle( + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + RichText( + text: TextSpan( + style: TextStyle(color: Colors.black), + children: [ + TextSpan( + text: "profile Name", + style: TextStyle( + fontWeight: FontWeight.bold, + ), + ), + TextSpan( + text: + " This is the most Amazing pic ever put on Instagram.", + ), + ], + ), + ), + Text( + "View all 13883 comments", + style: TextStyle( + color: Colors.black38, + ), + ) + ], + ), + ) + ], + ), + ), + ) + ], + )), + ), + ); + } +} diff --git a/lib/task_1/search_page.dart b/lib/task_1/search_page.dart new file mode 100644 index 0000000..01c3ef7 --- /dev/null +++ b/lib/task_1/search_page.dart @@ -0,0 +1,112 @@ +import 'package:flutter/material.dart'; + +class SearchPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + List buttons = [ + "IGTV", + "Travel", + "Architecture", + "Decor", + "Style", + "Food", + "Art", + "Beauty", + "DIY", + "Music", + ]; + List posts = [ + "images/post_1.jfif", + "images/post_2.jfif", + "images/post_3.jfif", + "images/post_4.jpg", + "images/post_5.jfif", + "images/post_6.jpg", + "images/post_7.jfif", + "images/post_8.jpg", + "images/post_9.jfif", + "images/post_9jpg.jpg", + "images/post_10.jpg", + "images/post_11.jpg", + "images/post_12.jfif", + "images/1.jpg", + "images/2.png", + "images/3.png", + "images/4.png", + "images/5.png", + "images/6.png", + "images/7.png", + "images/8.png", + + ]; + + return Scaffold( + body: SafeArea( + child: CustomScrollView( + slivers: [ + SliverAppBar( + primary: false, + title: TextFormField( + decoration: InputDecoration( + prefixIcon: Icon(Icons.search), + hintText: "Search", + contentPadding: EdgeInsets.all(0), + border: OutlineInputBorder( + borderSide: BorderSide.none, + borderRadius: BorderRadius.circular(10), + ), + fillColor: Color.fromARGB(40, 77, 40, 1), + filled: true, + ), + ), + actions: [ + IconButton( + onPressed: () {}, + icon: Icon(Icons.person_add), + ), + ], + ), + SliverAppBar( + titleSpacing: 0, + primary: false, + pinned: true, + title: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row( + children: List.generate( + 10, + (index) => Container( + padding: EdgeInsets.symmetric(horizontal: 5), + child: OutlineButton(onPressed: (){}, + child: Text( + buttons[index], + ), + ), + ), + ), + ), + ), + ), + SliverList(delegate: SliverChildListDelegate( + [ + GridView.builder( + padding: EdgeInsets.all(0), + shrinkWrap: true, + itemCount: 20, + physics: ScrollPhysics(parent: null), + gridDelegate:SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3), + itemBuilder: (context,index) => Container( + padding: EdgeInsets.all(2), + child: Image.asset(posts[index],fit: BoxFit.cover,), + ) + ), + ], + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/task_1/task_1.dart b/lib/task_1/task_1.dart new file mode 100644 index 0000000..0923551 --- /dev/null +++ b/lib/task_1/task_1.dart @@ -0,0 +1,118 @@ +import 'package:flutter/material.dart'; +import 'home_page.dart'; +import 'search_page.dart'; + +void main() { + runApp(const MyApp()); +} + +class MyApp extends StatelessWidget { + const MyApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Flutter Demo', + theme: ThemeData( + iconTheme: IconThemeData(color: Color.fromARGB(40, 40, 40, 1)), + appBarTheme: AppBarTheme( + elevation: 1, + color: Colors.white, + iconTheme: IconThemeData(color: Color.fromARGB(40, 40, 40, 1))), + primarySwatch: Colors.pink, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: MyHomePage(), + ); + } +} + +class MyHomePage extends StatefulWidget { + @override + State createState() => _MyHomePageState(); +} + +class _MyHomePageState extends State { + int currentPage = 0; + @override + Widget build(BuildContext context) { + return Scaffold( + body: currentPage == 1 ? SearchPage() : HomePage(), + bottomNavigationBar: BottomAppBar( + child: Row( + children: [ + IconButton( + icon: Icon( + Icons.home, + color: currentPage == 0 + ? Color.fromARGB(203, 73, 101, 1) + : Color.fromARGB(40, 40, 40, 1), + ), + onPressed: () { + setState(() { + currentPage = 0; + }); + }, + ), + Spacer(), + IconButton( + icon: Icon( + Icons.search, + color: currentPage == 1 + ? Color.fromARGB(203, 73, 101, 1) + : Color.fromARGB(40, 40, 40, 1), + ), + onPressed: () { + setState(() { + currentPage = 1; + }); + }, + ), + Spacer(), + IconButton( + icon: Icon( + Icons.ondemand_video, + color: currentPage == 2 + ? Color.fromARGB(203, 73, 101, 1) + : Color.fromARGB(40, 40, 40, 1), + ), + onPressed: () { + setState(() { + currentPage = 2; + }); + }, + ), + Spacer(), + IconButton( + icon: Icon( + Icons.card_travel, + color: currentPage == 3 + ? Color.fromARGB(203, 73, 101, 1) + : Color.fromARGB(40, 40, 40, 1), + ), + onPressed: () { + setState(() { + currentPage = 3; + }); + }, + ), + Spacer(), + IconButton( + icon: Icon( + Icons.person, + color: currentPage == 4 + ? Color.fromARGB(203, 73, 101, 1) + : Color.fromARGB(40, 40, 40, 1), + ), + onPressed: () { + setState(() { + currentPage = 4; + }); + }, + ), + ], + ), + ), + ); + } +} diff --git a/lib/task_2/database_helper.dart b/lib/task_2/database_helper.dart new file mode 100644 index 0000000..666e3d7 --- /dev/null +++ b/lib/task_2/database_helper.dart @@ -0,0 +1,35 @@ +import 'package:path/path.dart'; +import 'package:sqflite/sqflite.dart'; + +import 'models/task.dart'; + +class DatabaseHelper { + Future database() async { + return openDatabase( + join(await getDatabasesPath(), 'todo.db'), + onCreate: (db, version) { + return db.execute( + "CREATE TABLE tasks(id INTERGR PRIMARY KEY, title TEXT, description TEXT)", + ); + }, + version: 1, + ); + } + + Future insertTask(Task task) async { + Database _db = await database(); + await _db.insert('tasks', task.toMap(), + conflictAlgorithm: ConflictAlgorithm.replace); + } + + Future> getTasks() async { + Database _db = await database(); + final List> taskMap = await _db.query('tasks'); + return List.generate(taskMap.length, (index) { + return Task( + id: taskMap[index]['id'], + title: taskMap[index]['title'], + description: taskMap[index]['description']); + }); + } +} diff --git a/lib/task_2/main.dart b/lib/task_2/main.dart new file mode 100644 index 0000000..ecf9ee1 --- /dev/null +++ b/lib/task_2/main.dart @@ -0,0 +1,23 @@ +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:todonots/screens/homepage.dart'; + +void main() { + runApp(const MyApp()); +} + +class MyApp extends StatelessWidget { + const MyApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return MaterialApp( + debugShowCheckedModeBanner: false, + theme: ThemeData( + textTheme: GoogleFonts.nunitoSansTextTheme( + Theme.of(context).textTheme, + ), + ), + home: Homepage()); + } +} diff --git a/lib/task_2/models/task.dart b/lib/task_2/models/task.dart new file mode 100644 index 0000000..133e5f1 --- /dev/null +++ b/lib/task_2/models/task.dart @@ -0,0 +1,14 @@ +class Task { + final int id; + final String title; + final String description; + Task({this.id = 0, this.title = "no title", this.description = "some des"}); + + Map toMap() { + return { + 'id': id, + 'title': title, + 'description': description, + }; + } +} diff --git a/lib/task_2/pubspec.lock b/lib/task_2/pubspec.lock new file mode 100644 index 0000000..3370995 --- /dev/null +++ b/lib/task_2/pubspec.lock @@ -0,0 +1,301 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + url: "https://pub.dartlang.org" + source: hosted + version: "2.8.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + charcode: + dependency: transitive + description: + name: charcode + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.1" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + collection: + dependency: transitive + description: + name: collection + url: "https://pub.dartlang.org" + source: hosted + version: "1.15.0" + crypto: + dependency: transitive + description: + name: crypto + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.1" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.3" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" + ffi: + dependency: transitive + description: + name: ffi + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.2" + file: + dependency: transitive + description: + name: file + url: "https://pub.dartlang.org" + source: hosted + version: "6.1.2" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.4" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + google_fonts: + dependency: "direct main" + description: + name: google_fonts + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" + http: + dependency: transitive + description: + name: http + url: "https://pub.dartlang.org" + source: hosted + version: "0.13.4" + http_parser: + dependency: transitive + description: + name: http_parser + url: "https://pub.dartlang.org" + source: hosted + version: "4.0.0" + lints: + dependency: transitive + description: + name: lints + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" + matcher: + dependency: transitive + description: + name: matcher + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.10" + meta: + dependency: transitive + description: + name: meta + url: "https://pub.dartlang.org" + source: hosted + version: "1.7.0" + path: + dependency: "direct main" + description: + name: path + url: "https://pub.dartlang.org" + source: hosted + version: "1.8.0" + path_provider: + dependency: transitive + description: + name: path_provider + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.5" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" + path_provider_macos: + dependency: transitive + description: + name: path_provider_macos + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.2" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.1" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.3" + platform: + dependency: transitive + description: + name: platform + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.2" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.2" + process: + dependency: transitive + description: + name: process + url: "https://pub.dartlang.org" + source: hosted + version: "4.2.3" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + url: "https://pub.dartlang.org" + source: hosted + version: "1.8.1" + sqflite: + dependency: "direct main" + description: + name: sqflite + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0+4" + sqflite_common: + dependency: transitive + description: + name: sqflite_common + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.1+1" + stack_trace: + dependency: transitive + description: + name: stack_trace + url: "https://pub.dartlang.org" + source: hosted + version: "1.10.0" + stream_channel: + dependency: transitive + description: + name: stream_channel + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + synchronized: + dependency: transitive + description: + name: synchronized + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" + test_api: + dependency: transitive + description: + name: test_api + url: "https://pub.dartlang.org" + source: hosted + version: "0.4.2" + typed_data: + dependency: transitive + description: + name: typed_data + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0" + vector_math: + dependency: transitive + description: + name: vector_math + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" + win32: + dependency: transitive + description: + name: win32 + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.9" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.0" +sdks: + dart: ">=2.14.0 <3.0.0" + flutter: ">=2.5.0" diff --git a/lib/task_2/pubspec.yaml b/lib/task_2/pubspec.yaml new file mode 100644 index 0000000..f8c31bb --- /dev/null +++ b/lib/task_2/pubspec.yaml @@ -0,0 +1,89 @@ +name: todonots +description: A new Flutter project. + +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter 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.12.0 <3.0.0" + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +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 + google_fonts: ^2.1.0 + + sqflite: + path: + +dev_dependencies: + flutter_test: + sdk: flutter + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^1.0.0 + +# 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: + - assiets/images/ + # 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/lib/task_2/screens/homepage.dart b/lib/task_2/screens/homepage.dart new file mode 100644 index 0000000..2ed2ea1 --- /dev/null +++ b/lib/task_2/screens/homepage.dart @@ -0,0 +1,91 @@ +import 'package:flutter/material.dart'; +import 'package:todonots/database_helper.dart'; +import 'package:todonots/screens/taskpage.dart'; +import 'package:todonots/widgets.dart'; +import 'dart:async'; +import 'dart:core'; + +class Homepage extends StatefulWidget { + Homepage({Key? key}) : super(key: key); + + @override + _HomepageState createState() => _HomepageState(); +} + +class _HomepageState extends State { + DatabaseHelper _dbHelper = DatabaseHelper(); + @override + Widget build(BuildContext context) { + return Scaffold( + body: SafeArea( + child: Container( + width: double.infinity, + padding: EdgeInsets.symmetric(horizontal: 24.0), + color: Color(0xFFF6F6F6), + child: Stack( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(top: 32.0, bottom: 32.0), + child: Image( + image: AssetImage("assiets/images/logo.png"), + ), + ), + Expanded( + child: FutureBuilder( + initialData: [], + future: _dbHelper.getTasks(), + builder: (context, AsyncSnapshot snapshot) { + return ScrollConfiguration( + behavior: NoGlowBehaviour(), + child: ListView.builder( + itemCount: snapshot.data.length, + itemBuilder: (context, index) { + return TaskCardWidget( + title: snapshot.data[index].title, + ); + }, + ), + ); + }, + ), + ), + ], + ), + Positioned( + bottom: 24.0, + right: 0.0, + child: GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => Taskpage()), + ).then((value) { + setState(() {}); + }); + }, + child: Container( + width: 60.0, + height: 60.0, + decoration: BoxDecoration( + gradient: LinearGradient( + colors: [Color(0xFF7349FE), Color(0xFF643FDB)], + begin: Alignment(0.0, -1.0), + end: Alignment(0.0, 1.0)), + borderRadius: BorderRadius.circular(20.0), + ), + child: Image( + image: AssetImage("assiets/images/add_icon.png"), + ), + ), + ), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/task_2/screens/taskpage.dart b/lib/task_2/screens/taskpage.dart new file mode 100644 index 0000000..cd961c9 --- /dev/null +++ b/lib/task_2/screens/taskpage.dart @@ -0,0 +1,119 @@ +import 'package:flutter/material.dart'; +import 'package:todonots/database_helper.dart'; +import 'package:todonots/models/task.dart'; +import 'package:todonots/widgets.dart'; + +class Taskpage extends StatefulWidget { + Taskpage({Key? key}) : super(key: key); + + @override + _TaskpageState createState() => _TaskpageState(); +} + +class _TaskpageState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + body: SafeArea( + child: Container( + child: Stack( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only( + top: 24.0, + bottom: 6.0, + ), + child: Row( + children: [ + InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(24.0), + child: Image( + image: AssetImage( + "assiets/images/back_arrow_icon.png"), + ), + ), + ), + Expanded( + child: TextField( + onSubmitted: (value) async { + print("field $value"); + if (value != "") { + DatabaseHelper _dbHelper = DatabaseHelper(); + Task _newTask = Task( + title: value, + ); + await _dbHelper.insertTask(_newTask); + print("new task has been created "); + } + }, + decoration: InputDecoration( + hintText: "Enter Task title", + border: InputBorder.none), + style: TextStyle( + fontSize: 26.0, + fontWeight: FontWeight.bold, + color: Color(0xFF211551), + ), + ), + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 12.0), + child: TextField( + decoration: InputDecoration( + hintText: "Enter Description for the task...", + border: InputBorder.none, + contentPadding: EdgeInsets.symmetric( + horizontal: 24.0, + )), + ), + ), + TodoWidget( + text: " create your first Task", + isDone: true, + ), + TodoWidget(), + TodoWidget(), + TodoWidget(), + TodoWidget(), + ], + ), + Positioned( + bottom: 24.0, + right: 24.0, + child: GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => Taskpage()), + ); + }, + child: Container( + width: 60.0, + height: 60.0, + decoration: BoxDecoration( + color: Color(0xFFFE3577), + borderRadius: BorderRadius.circular(20.0), + ), + child: Image( + image: AssetImage("assiets/images/delete_icon.png"), + ), + ), + ), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/task_2/widgets.dart b/lib/task_2/widgets.dart new file mode 100644 index 0000000..af7ea81 --- /dev/null +++ b/lib/task_2/widgets.dart @@ -0,0 +1,98 @@ +import 'package:flutter/material.dart'; + +class TaskCardWidget extends StatelessWidget { + final String title; + final String desc; + TaskCardWidget({this.title = "(Unnamed Task)", this.desc = "(Unnamed Task)"}); + + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + padding: EdgeInsets.symmetric( + vertical: 32.0, + horizontal: 24.0, + ), + margin: EdgeInsets.only( + bottom: 20.0, + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(20.0), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: TextStyle( + color: Color(0xFF211551), + fontSize: 22.0, + fontWeight: FontWeight.bold, + ), + ), + Padding( + padding: const EdgeInsets.only(top: 8.0), + child: Text( + desc, + style: TextStyle( + fontSize: 16.0, + color: Color(0xFF86829D), + height: 1.5, + ), + ), + ), + ], + ), + ); + } +} + +class TodoWidget extends StatelessWidget { + final String text; + final bool isDone; + TodoWidget({this.text = "unNamed Todo ", this.isDone = false}); + @override + Widget build(BuildContext context) { + return Container( + padding: EdgeInsets.symmetric( + horizontal: 24.0, + vertical: 8.0, + ), + child: Row( + children: [ + Container( + width: 20.0, + height: 20.0, + margin: EdgeInsets.only( + right: 12.0, + ), + decoration: BoxDecoration( + color: isDone ? Color(0xFF7349FE) : Colors.transparent, + borderRadius: BorderRadius.circular(6.0), + border: isDone ? null : Border.all(color: Color(0xFF86829D))), + child: Image( + image: AssetImage("assiets/images/check_icon.png"), + ), + ), + Text( + text, + style: TextStyle( + color: isDone ? Color(0xFF211551) : Color(0xFF86829D), + fontSize: 16.0, + fontWeight: isDone ? FontWeight.bold : FontWeight.w500, + ), + ), + ], + ), + ); + } +} + +class NoGlowBehaviour extends ScrollBehavior { + @override + Widget buildViewportChrome( + BuildContext context, Widget child, AxisDirection axisDirection) { + return child; + } +} diff --git a/lib/task_3/main.dart b/lib/task_3/main.dart new file mode 100644 index 0000000..d687694 --- /dev/null +++ b/lib/task_3/main.dart @@ -0,0 +1,84 @@ +import 'package:flutter/material.dart'; +import 'package:weatherapp/models/data_service.dart'; +import 'package:weatherapp/models/model.dart'; + +void main() { + runApp(MyApp()); +} + +class MyApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp(home: HomePage()); + } +} + +class HomePage extends StatefulWidget { + HomePage({Key? key}) : super(key: key); + + @override + _HomePageState createState() => _HomePageState(); +} + +class _HomePageState extends State { + final _cityTextController = TextEditingController(); + final _dataService = DataService(); + + WeatherResponse? _response; + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Color(0xFFf9f9f9), + appBar: AppBar( + backgroundColor: Color(0xFFf9f), + elevation: 0.0, + title: const Text( + "Wether App", + style: TextStyle(color: Colors.black), + ), + centerTitle: true, + leading: IconButton( + onPressed: () {}, + icon: Icon(Icons.menu), + color: Colors.black, + ), + ), + body: Center( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + if (_response != null) + Column( + children: [ + Image.network(_response!.iconUrl), + Text( + '${_response!.tempInfo!.temperature}°', + style: TextStyle(fontSize: 40), + ), + Text(_response!.weatherInfo!.description) + ], + ), + Padding( + padding: EdgeInsets.symmetric(vertical: 50), + child: SizedBox( + width: 150, + child: TextField( + controller: _cityTextController, + decoration: InputDecoration(labelText: 'City'), + textAlign: TextAlign.center), + ), + ), + ElevatedButton(onPressed: _search, child: Text('Search')) + ], + ), + ), + ); + } + + void _search() async { + final response = await _dataService.getWeather(_cityTextController.text); + setState(() { + _response = response; + }); + } +} diff --git a/lib/task_3/models/data_service.dart b/lib/task_3/models/data_service.dart new file mode 100644 index 0000000..1a75edc --- /dev/null +++ b/lib/task_3/models/data_service.dart @@ -0,0 +1,23 @@ +import 'dart:convert'; + +import 'package:http/http.dart' as http; +import 'package:weatherapp/models/model.dart'; + +class DataService { + Future getWeather(String city) async { + // api.openweathermap.org/data/2.5/weather?q={city name}&appid={API key} + final queryParameters = { + 'q': city, + 'appid': 'a1a328d6c34374387310e72bd0699dcb', + 'units': 'imperial' + }; + + final uri = Uri.https( + 'api.openweathermap.org', '/data/2.5/weather', queryParameters); + final response = await http.get(uri); + + print(response.body); + final json = jsonDecode(response.body); + return WeatherResponse.fromJson(json); + } +} diff --git a/lib/task_3/models/model.dart b/lib/task_3/models/model.dart new file mode 100644 index 0000000..195b3df --- /dev/null +++ b/lib/task_3/models/model.dart @@ -0,0 +1,92 @@ +/* +{ + "coord": { + "lon": -122.08, + "lat": 37.39 + }, + "weather": [ + { + "id": 800, + "main": "Clear", + "description": "clear sky", + "icon": "01d" + } + ], + "base": "stations", + "main": { + "temp": 282.55, + "feels_like": 281.86, + "temp_min": 280.37, + "temp_max": 284.26, + "pressure": 1023, + "humidity": 100 + }, + "visibility": 16093, + "wind": { + "speed": 1.5, + "deg": 350 + }, + "clouds": { + "all": 1 + }, + "dt": 1560350645, + "sys": { + "type": 1, + "id": 5122, + "message": 0.0139, + "country": "US", + "sunrise": 1560343627, + "sunset": 1560396563 + }, + "timezone": -25200, + "id": 420006353, + "name": "Mountain View", + "cod": 200 + } +*/ +class WeatherInfo { + final String description; + final String icon; + WeatherInfo({required this.description, required this.icon}); + factory WeatherInfo.fromJson(Map json) { + final description = json['description']; + final icon = json['icon']; + return WeatherInfo(description: description, icon: icon); + } +} + +class TemperatureInfo { + final double temperature; + + TemperatureInfo({required this.temperature}); + + factory TemperatureInfo.fromJson(Map json) { + final temperature = json['temp']; + return TemperatureInfo(temperature: temperature); + } +} + +class WeatherResponse { + final String? cityName; + final TemperatureInfo? tempInfo; + final WeatherInfo? weatherInfo; + + String get iconUrl { + return 'https://openweathermap.org/img/wn/${weatherInfo!.icon}@2x.png'; + } + + WeatherResponse({this.cityName, this.tempInfo, this.weatherInfo}); + + factory WeatherResponse.fromJson(Map json) { + final cityName = json['name']; + + final tempInfoJson = json['main']; + final tempInfo = TemperatureInfo.fromJson(tempInfoJson); + + final WeatherInfoJson = json['weather'][0]; + final weatherInfo = WeatherInfo.fromJson(WeatherInfoJson); + + return WeatherResponse( + cityName: cityName, tempInfo: tempInfo, weatherInfo: weatherInfo); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index 1c93cc7..caafda0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,9 +1,9 @@ -name: contacts_01 +name: irqai description: A new Flutter project. # The following line prevents the package from being accidentally published to # pub.dev using `flutter pub publish`. This is preferred for private packages. -publish_to: 'none' # Remove this line if you wish to publish to pub.dev +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 @@ -30,7 +30,6 @@ 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 @@ -51,16 +50,36 @@ dev_dependencies: # 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: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg + assets: + - images/1.jpg + - images/2.png + - images/3.png + - images/4.png + - images/5.png + - images/6.png + - images/7.png + - images/8.png + - images/insta_logo.jpg + - images/insta_title.png + - images/post_1.jfif + - images/post_2.jfif + - images/post_3.jfif + - images/post_4.jpg + - images/post_5.jfif + - images/post_6.jpg + - images/post_7.jfif + - images/post_8.jpg + - images/post_9jpg.jpg + - images/post_10.jpg + - images/post_11.jpg + - images/post_12.jfif + - storybackground.jpg # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware.