diff --git a/ahamad asim.PNG b/ahamad asim.PNG new file mode 100644 index 0000000..f0c8adf Binary files /dev/null and b/ahamad asim.PNG differ diff --git a/apk/app-release.apk b/apk/app-release.apk new file mode 100644 index 0000000..71a3943 Binary files /dev/null and b/apk/app-release.apk differ diff --git a/news-api.PNG b/news-api.PNG new file mode 100644 index 0000000..6e4817b Binary files /dev/null and b/news-api.PNG differ diff --git a/newsapi/assets/icons/drawerIcon.png b/newsapi/assets/icons/drawerIcon.png new file mode 100644 index 0000000..6f22254 Binary files /dev/null and b/newsapi/assets/icons/drawerIcon.png differ diff --git a/newsapi/assets/icons/github.png b/newsapi/assets/icons/github.png new file mode 100644 index 0000000..e440081 Binary files /dev/null and b/newsapi/assets/icons/github.png differ diff --git a/newsapi/assets/icons/gmail.png b/newsapi/assets/icons/gmail.png new file mode 100644 index 0000000..4065cd4 Binary files /dev/null and b/newsapi/assets/icons/gmail.png differ diff --git a/newsapi/assets/icons/telephone.png b/newsapi/assets/icons/telephone.png new file mode 100644 index 0000000..17ebabb Binary files /dev/null and b/newsapi/assets/icons/telephone.png differ diff --git a/newsapi/assets/l.png b/newsapi/assets/l.png new file mode 100644 index 0000000..e7673fd Binary files /dev/null and b/newsapi/assets/l.png differ diff --git a/newsapi/lib/Model/article_model.dart b/newsapi/lib/Model/article_model.dart new file mode 100644 index 0000000..65627fb --- /dev/null +++ b/newsapi/lib/Model/article_model.dart @@ -0,0 +1,92 @@ + + +class Article { + Article({ + required this.status, + required this.totalResults, + required this.articles, + }); + late final String status; + late final int totalResults; + late final List articles; + + Article.fromJson(Map json){ + status = json['status']; + totalResults = json['totalResults']; + articles = List.from(json['articles']).map((e)=>Articles.fromJson(e)).toList(); + } + + Map toJson() { + final _data = {}; + _data['status'] = status; + _data['totalResults'] = totalResults; + _data['articles'] = articles.map((e)=>e.toJson()).toList(); + return _data; + } +} + +class Articles { + Articles({ + required this.source, + this.author, + required this.title, + this.description, + required this.url, + required this.urlToImage, + required this.publishedAt, + this.content, + }); + late final Source source; + late final String? author; + late final String? title; + late final String? description; + late final String? url; + late final String? urlToImage; + late final String? publishedAt; + late final String? content; + + Articles.fromJson(Map json){ + source = Source.fromJson(json['source']); + author = null; + title = json['title']; + description = json['description']; + url = json['url']; + urlToImage = json['urlToImage']; + publishedAt = json['publishedAt']; + content = null; + } + + Map toJson() { + final _data = {}; + _data['source'] = source.toJson(); + _data['author'] = author; + _data['title'] = title; + _data['description'] = description; + _data['url'] = url; + _data['urlToImage'] = urlToImage; + _data['publishedAt'] = publishedAt; + _data['content'] = content; + return _data; + } +} + +class Source { + Source({ + this.id, + required this.name, + }); + late final String? id; + late final String name; + + Source.fromJson(Map json){ + id = json['id']; + name = json['name']; + } + + Map toJson() { + final _data = {}; + _data['id'] = id; + _data['name'] = name; + return _data; + } +} \ No newline at end of file diff --git a/newsapi/lib/api/news.dart b/newsapi/lib/api/news.dart new file mode 100644 index 0000000..eb933ae --- /dev/null +++ b/newsapi/lib/api/news.dart @@ -0,0 +1,19 @@ +import 'dart:convert'; + +import 'package:http/http.dart' as http; +import 'package:newsapi/Model/article_model.dart'; + +class News{ + String url ="https://newsapi.org/v2/top-headlines?country=in&apiKey=cd79fff3bc1f495f82c4138d5c26fee4"; + Future
getNews()async{ + + var response =await http.get(Uri.parse(url)); + if(response.statusCode==200){ + + return Article.fromJson(jsonDecode(response.body)); + + }else{ + throw Exception("API call not successful"); + } + } +} diff --git a/newsapi/lib/generated_plugin_registrant.dart b/newsapi/lib/generated_plugin_registrant.dart new file mode 100644 index 0000000..07f8ddb --- /dev/null +++ b/newsapi/lib/generated_plugin_registrant.dart @@ -0,0 +1,18 @@ +// +// Generated file. Do not edit. +// + +// ignore_for_file: directives_ordering +// ignore_for_file: lines_longer_than_80_chars + +import 'package:fluttertoast/fluttertoast_web.dart'; +import 'package:url_launcher_web/url_launcher_web.dart'; + +import 'package:flutter_web_plugins/flutter_web_plugins.dart'; + +// ignore: public_member_api_docs +void registerPlugins(Registrar registrar) { + FluttertoastWebPlugin.registerWith(registrar); + UrlLauncherPlugin.registerWith(registrar); + registrar.registerMessageHandler(); +} \ No newline at end of file diff --git a/newsapi/lib/main.dart b/newsapi/lib/main.dart new file mode 100644 index 0000000..edb8046 --- /dev/null +++ b/newsapi/lib/main.dart @@ -0,0 +1,46 @@ +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; + +import 'news_ui/news_ui.dart'; +import 'profile/home_screen.dart'; + +void main() { + runApp(const MaterialApp( + debugShowCheckedModeBanner: false, + home: MyApp(), + )); +} + +class MyApp extends StatelessWidget { + const MyApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + body: HomePage(), + appBar: AppBar( + backgroundColor: Colors.white, + elevation: 0, + title: const Text( + "Profile", + style: TextStyle(fontSize: 30, color: Colors.black), + ), + actions: [ + GestureDetector( + onTap: () { + Navigator.of(context) + .push(MaterialPageRoute(builder: (context) => NewsUi())); + }, + child: Padding( + padding: EdgeInsets.all(15.0), + child: Text( + 'News App ', + style: TextStyle(color: Colors.blue, fontSize: 20), + ), + ), + ) + ]), + ); + } +} \ No newline at end of file diff --git a/newsapi/lib/news_ui/cards.dart b/newsapi/lib/news_ui/cards.dart new file mode 100644 index 0000000..200cacb --- /dev/null +++ b/newsapi/lib/news_ui/cards.dart @@ -0,0 +1,184 @@ +import 'package:flutter/material.dart'; +import 'package:fluttertoast/fluttertoast.dart'; + +import 'news_ui.dart'; +import 'package:url_launcher/url_launcher.dart'; + +class NewsHorizontalCards extends StatefulWidget { + final String title; + + final String url; + + final String? urlToImage; + final String publishedAt; + + NewsHorizontalCards({ + required this.url, + required this.publishedAt, + required this.title, + required this.urlToImage, + }); + + @override + State createState() => _NewsHorizontalCardsState(); +} + +class _NewsHorizontalCardsState extends State { + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.only(top: 20, left: 15), + width: 330, + height: 360, + decoration: BoxDecoration( + border: Border.all( + width: .5, + color: Colors.grey.shade400, + ), + borderRadius: BorderRadius.circular(20)), + child: InkWell( + onTap: () { + _launchURL(); + }, + child: Column( + children: [ + Padding( + padding: EdgeInsets.all(20.0), + child: Row( + children: [ + SizedBox( + width: 10, + ), + ], + ), + ), + Container( + width: 300, + height: 180, + decoration: BoxDecoration( + color: Colors.black, + borderRadius: BorderRadius.circular(20), + ), + child: ClipRRect( + borderRadius: BorderRadius.only( + topRight: Radius.circular(20), + topLeft: Radius.circular(20)), + child: Image.network( + widget.urlToImage!, + fit: BoxFit.cover, + width: 300, + height: 180, + ), + ), + ), + SizedBox( + width: 310, + child: Text( + widget.title, + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: TextStyle(fontSize: 21), + ), + ), + SizedBox( + height: 10, + ), + SizedBox( + width: 300, + child: Row( + children: [ + Text( + "${widget.publishedAt} ", + style: TextStyle(color: Colors.grey.shade700), + ), + ], + ), + ) + ], + ), + ), + ); + } + + void _launchURL() async => await canLaunch(widget.url) + ? await launch(widget.url) + : Fluttertoast.showToast( + msg: "couldn't find the url ${widget.url}", + toastLength: Toast.LENGTH_SHORT, + gravity: ToastGravity.SNACKBAR, + backgroundColor: Colors.blueGrey, + textColor: Colors.white, + fontSize: 16.0, + ); +} + +class NewsVerticalCards extends StatefulWidget { + final String? title; + final String? description; + final String? url; + final String? urlToImage; + final String? publishedAt; + + NewsVerticalCards({ + required this.url, + required this.description, + required this.publishedAt, + required this.title, + required this.urlToImage, + }); + + @override + State createState() => _NewsVerticalCardsState(); +} + +class _NewsVerticalCardsState extends State { + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.only(top: 20, left: 12, right: 12), + height: 200, + width: 100, + decoration: BoxDecoration( + border: Border.all(color: Colors.grey.shade400, width: .5), + borderRadius: BorderRadius.circular(20), + ), + child: ListTile(onTap:() { + _launchURL(); + }, + title: Container( + margin: EdgeInsets.only(top: 15, left: 10), + width: 260, + child: Column( + children: [ + Text( + widget.title!, + style: TextStyle(fontSize: 20, overflow: TextOverflow.fade), + ), + ], + ), + ), + leading: Container( + + width: 100, + height: 300, + child: Image.network( + widget.urlToImage!, + fit: BoxFit.cover, + width: 120, + height: 300, + ), + ), + )); + } + + void _launchURL() async => await canLaunch(widget.url!) + ? await launch(widget.url!) + : Fluttertoast.showToast( + msg: "couldn't find the url ${widget.url}", + toastLength: Toast.LENGTH_SHORT, + gravity: ToastGravity.SNACKBAR, + backgroundColor: Colors.blueGrey, + textColor: Colors.white, + fontSize: 16.0, + ); +} \ No newline at end of file diff --git a/newsapi/lib/news_ui/news_ui.dart b/newsapi/lib/news_ui/news_ui.dart new file mode 100644 index 0000000..6e0e85f --- /dev/null +++ b/newsapi/lib/news_ui/news_ui.dart @@ -0,0 +1,201 @@ +import 'dart:math'; + +import 'package:flutter/material.dart'; +import 'package:fluttertoast/fluttertoast.dart'; + +import 'package:newsapi/api/news.dart'; + +import 'cards.dart'; +import 'package:newsapi/Model/article_model.dart'; + +class NewsUi extends StatefulWidget { + NewsUi({ + Key? key, + }) : super(key: key); + + @override + State createState() => _NewsUiState(); +} + +class _NewsUiState extends State { + var url = Uri.parse( + 'https://newsapi.org/v2/top-headlines?country=in&apiKey=cd79fff3bc1f495f82c4138d5c26fee4'); + + @override + Widget build(BuildContext context) { + return MaterialApp( + debugShowCheckedModeBanner: false, + home: Scaffold( + backgroundColor: Colors.white, + appBar: AppBar( + toolbarHeight: 80, + backgroundColor: Colors.white, + elevation: 0, + leading: Builder( + builder: (context) => IconButton( + icon: Image.asset( + "assets/icons/drawerIcon.png", + height: 200, + width: 200, + ), + onPressed: () => Scaffold.of(context).openDrawer(), + ), + ), + ), + drawer: Drawer(), + body: NewsHome(), + ), + ); + } +} + +class NewsHome extends StatefulWidget { + @override + State createState() => _NewsHomeState(); +} + +class _NewsHomeState extends State { + @override + Widget build(BuildContext context) { + return SafeArea( + child: ListView( + scrollDirection: Axis.vertical, + physics: BouncingScrollPhysics(), + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + GestureDetector( + onTap: () {}, + child: Text( + "Popular", + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + ), + ), + ), + GestureDetector( + onTap: () {}, + child: Text( + "Trending", + style: TextStyle( + fontSize: 25, + fontWeight: null, + ), + ), + ), + GestureDetector( + onTap: () {}, + child: Text( + "Recent", + style: TextStyle( + fontSize: 25, + fontWeight: null, + ), + ), + ), + ], + ), + SizedBox( + height: 350, + child: FutureBuilder
( + future: News().getNews(), + builder: ( + context, + snapshot, + ) { + if (snapshot.hasData) { + return ListView.builder( + itemCount: snapshot.data!.articles.length, + scrollDirection: Axis.horizontal, + physics: BouncingScrollPhysics(), + itemBuilder: (BuildContext context, int index) { + var data = snapshot.data!.articles[index]; + print( + data.urlToImage.toString(), + ); + return NewsHorizontalCards( + title: data.title.toString(), + urlToImage: data.urlToImage.toString(), + publishedAt: data.publishedAt.toString(), + url: data.url.toString(), + ); + }); + } else if (snapshot.hasError) { + return Text(snapshot.error.toString()); + } else { + return Center( + child: Container(padding: EdgeInsets.all(20), + height: 70, + width: 70, + child: CircularProgressIndicator()), + ); + } + }), + ), + Container( + margin: EdgeInsets.only(left: 20, top: 20), + width: MediaQuery.of(context).size.width, + child: Text( + "BASED ON YOUR READING HISTORY", + style: TextStyle(fontSize: 18, color: Colors.grey), + ), + ), + FutureBuilder
( + future: News().getNews(), + builder: ( + context, + snapshot, + ) { + if (snapshot.hasData) { + return ListView.builder( + shrinkWrap: true, + itemCount: snapshot.data!.articles.length - 1, + scrollDirection: Axis.vertical, + physics: BouncingScrollPhysics(), + itemBuilder: (BuildContext context, int index) { + var data = snapshot.data!.articles[index]; + + return NewsVerticalCards( + description: data.description.toString(), + title: data.title.toString(), + urlToImage: data.urlToImage.toString(), + publishedAt: data.publishedAt.toString(), + url: data.url.toString(), + ); + }); + } else if (snapshot.hasError) { + return Text(snapshot.error.toString()); + } else { + return Center( + child: Container(padding: EdgeInsets.all(20), + height: 70, + width: 70, + child: CircularProgressIndicator()), + ); + } + }), + ]), + ); + } +} + +class MyBullet extends StatefulWidget { + @override + State createState() => _MyBulletState(); +} + +class _MyBulletState extends State { + @override + Widget build(BuildContext context) { + return Container( + height: 5.0, + width: 5.0, + decoration: BoxDecoration( + color: Colors.grey, + shape: BoxShape.circle, + ), + ); + } +} \ No newline at end of file diff --git a/newsapi/lib/profile/circle_avatar_widget.dart b/newsapi/lib/profile/circle_avatar_widget.dart new file mode 100644 index 0000000..7448479 --- /dev/null +++ b/newsapi/lib/profile/circle_avatar_widget.dart @@ -0,0 +1,47 @@ +import 'package:flutter/material.dart'; + + + +class CircleAvatarWidget extends StatelessWidget { + final double width; + final double height; + final double radius; + + final String? iconImage; + + const CircleAvatarWidget({ + required this.width, + required this.height, + required this.radius, + required this.iconImage, + }); + + @override + Widget build(BuildContext context) { + return Container( + decoration: const BoxDecoration( + shape: BoxShape.circle, + boxShadow: [ + BoxShadow( + blurRadius: 5, + color: Colors.grey, + spreadRadius: 1, + offset: Offset( + 5, + 7, + ), + ), + ], + ), + width: width, + height: height, + child: CircleAvatar( + backgroundColor: Colors.white, + radius: radius, + backgroundImage: AssetImage( + iconImage!, + ), + ), + ); + } +} \ No newline at end of file diff --git a/newsapi/lib/profile/home_screen.dart b/newsapi/lib/profile/home_screen.dart new file mode 100644 index 0000000..17e7d21 --- /dev/null +++ b/newsapi/lib/profile/home_screen.dart @@ -0,0 +1,141 @@ +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:url_launcher/url_launcher.dart'; + +import 'circle_avatar_widget.dart'; + +class HomePage extends StatefulWidget { + HomePage({ + Key? key, + }) : super(key: key); + + @override + State createState() => _HomePageState(); +} + +class _HomePageState extends State { + @override + Widget build(BuildContext context) { + return SafeArea( + child: Container( + child: ListView( + physics:BouncingScrollPhysics() , + scrollDirection: Axis.vertical, + children: [ + Center( + child: Column( + children: [ + CircleAvatarWidget( + height: 130, + width: 200, + radius: 2500, + iconImage: "assets/l.png", + ), + SizedBox( + height: 15, + ), + Text( + 'Ahamad Asim', + style: GoogleFonts.italiana(fontSize: 40,color: Colors.black87), + ), + Text( + 'Developer', + style: GoogleFonts.italiana(fontSize: 20,color: Colors.black), + ), + Container( + width: 150, + child: Divider( + thickness: 2, + ), + ), + SizedBox( + height: 10, + ), + Container( + padding: EdgeInsets.only(right: 15,left: 20), + child: Column( + children: [ + Row( + children: [ + Text( + "Hi,I am a", + style: TextStyle(fontSize: 15,color: Colors.black), + ), + Text( + "Developer ", + style: TextStyle( + fontSize: 17,color: Colors.black, fontWeight: FontWeight.w700), + ), + Text( + "based in Kozhikode, Kerala", + style: TextStyle( + fontSize: 16,color: Colors.black + ), + ), + ], + ), + ], + ), + ), + Container( + height: 30, + width: 350, + child: Divider( + thickness: 2, + ), + ), + GestureDetector( + onTap: () { + launch( + "mailto:ahamadasimash4@gmail.com?subject=&body="); + }, + child: ListTile( + title: Text("ahamadasimash4@gmail.com",style: TextStyle(color: Colors.black),), + leading: CircleAvatarWidget( + width: 40, + height: 30, + radius: 0, + iconImage: "assets/icons/gmail.png", + ), + ), + + ), + SizedBox( + height: 10, + ), + GestureDetector( + onTap: () { + launch("https://github.com/Ahamad-Asim"); + }, + child: ListTile( + title: Text("https://github.com/Ahamad-Asim",style: TextStyle(color: Colors.black),), + leading: CircleAvatarWidget( + width: 40, + height: 30, + radius: 0, + iconImage: "assets/icons/github.png", + ), + ), + ), + SizedBox( + height: 10, + ), + ListTile( + title: Text("7306631960",style: TextStyle(color: Colors.black),), + leading: CircleAvatarWidget( + width: 40, + height: 30, + radius: 0, + iconImage: "assets/icons/telephone.png", + ), + ), + ], + ), + ), + ], + ), + ), + ); + } +} + diff --git a/newsapi/pubspec.lock b/newsapi/pubspec.lock new file mode 100644 index 0000000..40a9586 --- /dev/null +++ b/newsapi/pubspec.lock @@ -0,0 +1,355 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + alert: + dependency: "direct main" + description: + name: alert + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.1" + 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" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + fluttertoast: + dependency: "direct main" + description: + name: fluttertoast + url: "https://pub.dartlang.org" + source: hosted + version: "8.0.8" + google_fonts: + dependency: "direct main" + description: + name: google_fonts + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" + http: + dependency: "direct main" + 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" + js: + dependency: transitive + description: + name: js + url: "https://pub.dartlang.org" + source: hosted + version: "0.6.3" + 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: transitive + 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" + persistent_bottom_nav_bar: + dependency: "direct main" + description: + name: persistent_bottom_nav_bar + url: "https://pub.dartlang.org" + source: hosted + version: "4.0.2" + 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.4" + 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" + 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" + 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" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + url: "https://pub.dartlang.org" + source: hosted + version: "6.0.12" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.2" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.2" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.4" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.4" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.2" + 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.10" + 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" \ No newline at end of file diff --git a/newsapi/pubspec.yaml b/newsapi/pubspec.yaml new file mode 100644 index 0000000..8e1e84f --- /dev/null +++ b/newsapi/pubspec.yaml @@ -0,0 +1,97 @@ +name: newsapi +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 + url_launcher: ^6.0.11 + persistent_bottom_nav_bar: ^4.0.2 + http: ^0.13.4 + alert: ^2.0.1 + fluttertoast: ^8.0.8 + + +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: + - assets/ + - assets/icons/ + - assets/icons/drawerIcon.png + + # 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 \ No newline at end of file diff --git a/newsapi/test/widget_test.dart b/newsapi/test/widget_test.dart new file mode 100644 index 0000000..eb5e8b6 --- /dev/null +++ b/newsapi/test/widget_test.dart @@ -0,0 +1,30 @@ +// This is a basic Flutter widget test. +// +// To perform an interaction with a widget in your test, use the WidgetTester +// utility that Flutter provides. For example, you can send tap and scroll +// gestures. You can also use WidgetTester to find child widgets in the widget +// tree, read text, and verify that the values of widget properties are correct. + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'package:newsapi/main.dart'; + +void main() { + testWidgets('Counter increments smoke test', (WidgetTester tester) async { + // Build our app and trigger a frame. + await tester.pumpWidget(const MyApp()); + + // Verify that our counter starts at 0. + expect(find.text('0'), findsOneWidget); + expect(find.text('1'), findsNothing); + + // Tap the '+' icon and trigger a frame. + await tester.tap(find.byIcon(Icons.add)); + await tester.pump(); + + // Verify that our counter has incremented. + expect(find.text('0'), findsNothing); + expect(find.text('1'), findsOneWidget); + }); +}