diff --git a/NewsApp/devtools_options.yaml b/NewsApp/devtools_options.yaml new file mode 100644 index 0000000..7e7e7f6 --- /dev/null +++ b/NewsApp/devtools_options.yaml @@ -0,0 +1 @@ +extensions: diff --git a/NewsApp/lib/components/customListTile.dart b/NewsApp/lib/components/customListTile.dart index 8840117..1c31b31 100644 --- a/NewsApp/lib/components/customListTile.dart +++ b/NewsApp/lib/components/customListTile.dart @@ -1,29 +1,33 @@ -import 'package:NewsApp/model/article_model.dart'; +import 'package:NewsApp/models/topNews.model.dart'; import 'package:NewsApp/pages/articles_details_page.dart'; import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; -Widget customListTile(Article article, BuildContext context) { +Widget customListTile(Articles article, BuildContext context) { return InkWell( onTap: () { Navigator.push( - context, - MaterialPageRoute( - builder: (context) => ArticlePage( - article: article, - ))); + context, + MaterialPageRoute( + builder: (context) => ArticlePage( + article: article, + ), + ), + ); }, child: Container( margin: EdgeInsets.all(12.0), padding: EdgeInsets.all(8.0), decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(12.0), - boxShadow: [ - BoxShadow( - color: Colors.black12, - blurRadius: 3.0, - ), - ]), + color: Colors.white, + borderRadius: BorderRadius.circular(12.0), + boxShadow: [ + BoxShadow( + color: Colors.black12, + blurRadius: 3.0, + ), + ], + ), child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, @@ -32,39 +36,49 @@ Widget customListTile(Article article, BuildContext context) { height: 200.0, width: double.infinity, decoration: BoxDecoration( - //let's add the height - image: DecorationImage( - image: NetworkImage(article.urlToImage), fit: BoxFit.cover), + image: NetworkImage(article.urlToImage ?? + 'https://via.placeholder.com/750x500.jpeg?text=Image+Error'), + fit: BoxFit.cover, + ), borderRadius: BorderRadius.circular(12.0), ), ), - SizedBox( - height: 8.0, - ), + SizedBox(height: 8.0), Container( padding: EdgeInsets.all(6.0), - decoration: BoxDecoration( - color: Colors.red, - borderRadius: BorderRadius.circular(30.0), - ), child: Text( - article.source.name, + article.title ?? 'No Title', style: TextStyle( - color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 16.0, ), ), ), - SizedBox( - height: 8.0, - ), - Text( - article.title, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16.0, + SizedBox(height: 8.0), + Container( + padding: EdgeInsets.all(6.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + article.source?.name ?? 'Unknown', + style: TextStyle( + color: Colors.blue, + ), + ), + Text( + article.publishedAt != null + ? DateFormat('dd MMMM yyyy') + .format(DateTime.parse(article.publishedAt!)) + : 'Unknown', + style: TextStyle( + color: Colors.blue, + ), + ), + ], ), - ) + ), ], ), ), diff --git a/NewsApp/lib/components/everythingList.dart b/NewsApp/lib/components/everythingList.dart new file mode 100644 index 0000000..f3c2c32 --- /dev/null +++ b/NewsApp/lib/components/everythingList.dart @@ -0,0 +1,94 @@ +import 'package:NewsApp/models/topNews.model.dart'; +import 'package:NewsApp/pages/articles_details_page.dart'; +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; + +Widget everythingListTile(Articles article, BuildContext context) { + return InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ArticlePage( + article: article, + ), + ), + ); + }, + child: Container( + margin: EdgeInsets.all(12.0), + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12.0), + boxShadow: [ + BoxShadow( + color: Colors.black12, + blurRadius: 3.0, + ), + ], + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 150.0, + height: 200.0, + decoration: BoxDecoration( + image: DecorationImage( + image: NetworkImage(article.urlToImage ?? + 'https://via.placeholder.com/750x500.jpeg?text=Image+Error'), + fit: BoxFit.cover, + ), + borderRadius: BorderRadius.circular(12.0), + ), + ), + SizedBox(width: 8.0), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + article.title ?? 'No Title', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 16.0, + ), + ), + SizedBox(height: 8.0), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Icon(Icons.account_circle, color: Colors.blue), + SizedBox(width: 4.0), + Text( + article.author ?? 'Unknown', + style: TextStyle(color: Colors.blue), + ), + ], + ), + Row( + children: [ + Icon(Icons.calendar_today, color: Colors.blue), + SizedBox(width: 4.0), + Text( + article.publishedAt != null + ? DateFormat('dd MMMM yyyy') + .format(DateTime.parse(article.publishedAt!)) + : 'Unknown', + style: TextStyle(color: Colors.blue), + ), + ], + ), + ], + ), + ], + ), + ), + ], + ), + ), + ); +} diff --git a/NewsApp/lib/helpers/api.dart b/NewsApp/lib/helpers/api.dart new file mode 100644 index 0000000..bd72b01 --- /dev/null +++ b/NewsApp/lib/helpers/api.dart @@ -0,0 +1,13 @@ +import 'package:dio/dio.dart'; + +final dio = Dio(); + +api(String url, {String? method, String? data}) async { + final response = await dio.request( + url, + data: data, + options: Options(method: method), + ); + + return response; +} diff --git a/NewsApp/lib/main.dart b/NewsApp/lib/main.dart index 718d1a9..22ba312 100644 --- a/NewsApp/lib/main.dart +++ b/NewsApp/lib/main.dart @@ -1,18 +1,23 @@ -import 'package:NewsApp/services/api_service.dart'; +import 'package:NewsApp/components/everythingList.dart'; +import 'package:NewsApp/models/topNews.model.dart'; +import 'package:NewsApp/providers/news.provider.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + import 'components/customListTile.dart'; -import 'model/article_model.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { - // This widget is the root of your application. @override Widget build(BuildContext context) { - return MaterialApp( - home: HomePage(), + return ChangeNotifierProvider( + create: (context) => NewsProvider(), + child: MaterialApp( + home: HomePage(), + ), ); } } @@ -23,34 +28,88 @@ class HomePage extends StatefulWidget { } class _HomePageState extends State { - ApiService client = ApiService(); + @override + void initState() { + super.initState(); + Provider.of(context, listen: false).getTopNews(); + } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text("News App", style: TextStyle(color: Colors.black)), backgroundColor: Colors.white, + title: Row( + children: [ + CircleAvatar( + radius: 20.0, + backgroundColor: Colors.blue, + ), + SizedBox(width: 10.0), + Text( + "Mandiri News", + style: + TextStyle(color: Colors.black, fontWeight: FontWeight.bold), + ), + ], + ), ), - - //Now let's call the APi services with futurebuilder wiget - body: FutureBuilder( - future: client.getArticle(), - builder: (BuildContext context, AsyncSnapshot> snapshot) { - //let's check if we got a response or not - if (snapshot.hasData) { - //Now let's make a list of articles - List
articles = snapshot.data; - return ListView.builder( - //Now let's create our custom List tile - itemCount: articles.length, - itemBuilder: (context, index) => - customListTile(articles[index], context), + body: Consumer( + builder: (context, newsProvider, child) { + if (newsProvider.isLoading) { + return Center(child: CircularProgressIndicator(color: Colors.blue)); + } else if (newsProvider.resNews != null) { + List? articles = newsProvider.resNews!.articles!; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: ListView.builder( + itemCount: articles.length, + itemBuilder: (context, index) { + if (index == 0) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.0), + child: Text( + 'Berita Terkini', + textAlign: TextAlign.start, + style: TextStyle(fontSize: 20), + ), + ), + customListTile(articles[index], context), + ], + ); + } else { + if (index == 1) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.0), + child: Text( + 'Semua Berita', + textAlign: TextAlign.start, + style: TextStyle(fontSize: 20), + ), + ), + everythingListTile(articles[index], context), + ], + ); + } else { + return everythingListTile(articles[index], context); + } + } + }, + ), + ), + ], ); + } else { + return Center(child: Text("Failed to load news")); } - return Center( - child: CircularProgressIndicator(), - ); }, ), ); diff --git a/NewsApp/lib/model/article_model.dart b/NewsApp/lib/model/article_model.dart deleted file mode 100644 index eb540a0..0000000 --- a/NewsApp/lib/model/article_model.dart +++ /dev/null @@ -1,41 +0,0 @@ -//Now let's create the article model -// for that we just need to copy the property from the json structure -// and make a dart object - -import 'source_model.dart'; - -class Article { - Source source; - String author; - String title; - String description; - String url; - String urlToImage; - String publishedAt; - String content; - - //Now let's create the constructor - Article( - {this.source, - this.author, - this.title, - this.description, - this.url, - this.urlToImage, - this.publishedAt, - this.content}); - - //And now let's create the function that will map the json into a list - factory Article.fromJson(Map json) { - return Article( - source: Source.fromJson(json['source']), - author: json['author'] as String, - title: json['title'] as String, - description: json['description'] as String, - url: json['url'] as String, - urlToImage: json['urlToImage'] as String, - publishedAt: json['publishedAt'] as String, - content: json['content'] as String, - ); - } -} diff --git a/NewsApp/lib/model/source_model.dart b/NewsApp/lib/model/source_model.dart deleted file mode 100644 index 4fabdef..0000000 --- a/NewsApp/lib/model/source_model.dart +++ /dev/null @@ -1,15 +0,0 @@ -//let's start by making the source model class so -// it will be easier to parse the Json - -class Source { - String id; - String name; - - //Let's create the constructor - Source({this.id, this.name}); - - //Let's create the factory function to map the json - factory Source.fromJson(Map json) { - return Source(id: json['id'], name: json['name']); - } -} diff --git a/NewsApp/lib/models/topNews.model.dart b/NewsApp/lib/models/topNews.model.dart new file mode 100644 index 0000000..fdc0177 --- /dev/null +++ b/NewsApp/lib/models/topNews.model.dart @@ -0,0 +1,94 @@ +class TopNewsModel { + String? status; + int? totalResults; + List? articles; + + TopNewsModel({this.status, this.totalResults, this.articles}); + + TopNewsModel.fromJson(Map json) { + status = json['status']; + totalResults = json['totalResults']; + if (json['articles'] != null) { + articles = []; + json['articles'].forEach((v) { + articles!.add(Articles.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = {}; + data['status'] = status; + data['totalResults'] = totalResults; + if (articles != null) { + data['articles'] = articles!.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class Articles { + Source? source; + String? author; + String? title; + String? description; + String? url; + String? urlToImage; + String? publishedAt; + String? content; + + Articles( + {this.source, + this.author, + this.title, + this.description, + this.url, + this.urlToImage, + this.publishedAt, + this.content}); + + Articles.fromJson(Map json) { + source = json['source'] != null ? Source.fromJson(json['source']) : null; + author = json['author']; + title = json['title']; + description = json['description']; + url = json['url']; + urlToImage = json['urlToImage']; + publishedAt = json['publishedAt']; + content = json['content']; + } + + Map toJson() { + final Map data = {}; + if (source != null) { + 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 { + String? id; + String? name; + + Source({this.id, this.name}); + + Source.fromJson(Map json) { + id = json['id']; + name = json['name']; + } + + Map toJson() { + final Map data = {}; + data['id'] = id; + data['name'] = name; + return data; + } +} diff --git a/NewsApp/lib/pages/articles_details_page.dart b/NewsApp/lib/pages/articles_details_page.dart index a19515a..876ff40 100644 --- a/NewsApp/lib/pages/articles_details_page.dart +++ b/NewsApp/lib/pages/articles_details_page.dart @@ -1,18 +1,16 @@ -//Now let's create the article details page - -import 'package:NewsApp/model/article_model.dart'; +import 'package:NewsApp/models/topNews.model.dart'; import 'package:flutter/material.dart'; class ArticlePage extends StatelessWidget { - final Article article; + final Articles article; - ArticlePage({this.article}); + ArticlePage({required this.article}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text(article.title), + title: Text(article.title ?? 'No Title'), ), body: Padding( padding: const EdgeInsets.all(8.0), @@ -24,10 +22,9 @@ class ArticlePage extends StatelessWidget { height: 200.0, width: double.infinity, decoration: BoxDecoration( - //let's add the height - image: DecorationImage( - image: NetworkImage(article.urlToImage), fit: BoxFit.cover), + image: NetworkImage(article.urlToImage ?? ''), + fit: BoxFit.cover), borderRadius: BorderRadius.circular(12.0), ), ), @@ -41,7 +38,7 @@ class ArticlePage extends StatelessWidget { borderRadius: BorderRadius.circular(30.0), ), child: Text( - article.source.name, + article.source?.name ?? 'Unknown', style: TextStyle( color: Colors.white, ), @@ -51,7 +48,7 @@ class ArticlePage extends StatelessWidget { height: 8.0, ), Text( - article.description, + article.description ?? '', style: TextStyle( fontWeight: FontWeight.bold, fontSize: 16.0, diff --git a/NewsApp/lib/providers/news.provider.dart b/NewsApp/lib/providers/news.provider.dart new file mode 100644 index 0000000..ac3462d --- /dev/null +++ b/NewsApp/lib/providers/news.provider.dart @@ -0,0 +1,27 @@ +import 'package:NewsApp/helpers/api.dart'; +import 'package:NewsApp/models/topNews.model.dart'; +import 'package:NewsApp/utils/const.dart'; +import 'package:flutter/material.dart'; + +class NewsProvider with ChangeNotifier { + bool isLoading = true; + TopNewsModel? resNews; + + Future getTopNews() async { + try { + final res = await api( + '${baseUrl}top-headlines?country=us&pageSize=100&apiKey=$API_KEY'); + + if (res.statusCode == 200) { + resNews = TopNewsModel.fromJson(res.data); + } else { + throw Exception('Failed to load news: ${res.statusCode}'); + } + } catch (e) { + throw Exception('Failed to load news: $e'); + } + + isLoading = false; + notifyListeners(); + } +} diff --git a/NewsApp/lib/services/api_service.dart b/NewsApp/lib/services/api_service.dart deleted file mode 100644 index d9f3009..0000000 --- a/NewsApp/lib/services/api_service.dart +++ /dev/null @@ -1,41 +0,0 @@ -import 'dart:convert'; - -import 'package:NewsApp/model/article_model.dart'; -import 'package:http/http.dart'; - -//Now let's make the HTTP request services -// this class will alows us to make a simple get http request -// from the API and get the Articles and then return a list of Articles - -class ApiService { - //let's add an Endpoint URL, you can check the website documentation - // and learn about the different Endpoint - //for this example I'm going to use a single endpoint - - //NOTE: make sure to use your OWN apikey, you can make a free acount and - // choose a developer option it's FREE - final endPointUrl = - "http://newsapi.org/v2/top-headlines?country=us&category=business&apiKey={ADD YOUR API KEY HERE}"; - - //Now let's create the http request function - // but first let's import the http package - - Future> getArticle() async { - Response res = await get(endPointUrl); - - //first of all let's check that we got a 200 statu code: this mean that the request was a succes - if (res.statusCode == 200) { - Map json = jsonDecode(res.body); - - List body = json['articles']; - - //this line will allow us to get the different articles from the json file and putting them into a list - List
articles = - body.map((dynamic item) => Article.fromJson(item)).toList(); - - return articles; - } else { - throw ("Can't get the Articles"); - } - } -} diff --git a/NewsApp/lib/utils/const.dart b/NewsApp/lib/utils/const.dart new file mode 100644 index 0000000..2424a15 --- /dev/null +++ b/NewsApp/lib/utils/const.dart @@ -0,0 +1,2 @@ +const baseUrl = 'https://newsapi.org/v2/'; +const API_KEY = 'c19b0a831e2e4a1bbd04fa118ad61326'; diff --git a/NewsApp/pubspec.lock b/NewsApp/pubspec.lock index 8d67457..e8f2fb8 100644 --- a/NewsApp/pubspec.lock +++ b/NewsApp/pubspec.lock @@ -5,63 +5,79 @@ packages: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" source: hosted - version: "2.5.0-nullsafety" + version: "2.11.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "2.1.0-nullsafety" + version: "2.1.1" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" source: hosted - version: "1.1.0-nullsafety.2" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0-nullsafety" + version: "1.3.0" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" source: hosted - version: "1.1.0-nullsafety" + version: "1.1.1" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" source: hosted - version: "1.15.0-nullsafety.2" + version: "1.18.0" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.dartlang.org" + sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d + url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "1.0.6" + dio: + dependency: "direct main" + description: + name: dio + sha256: "0978e9a3e45305a80a7210dbeaf79d6ee8bee33f70c8e542dc654c952070217f" + url: "https://pub.dev" + source: hosted + version: "5.4.2+1" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" source: hosted - version: "1.1.0-nullsafety" + version: "1.3.1" flutter: dependency: "direct main" description: flutter source: sdk version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" flutter_test: dependency: "direct dev" description: flutter @@ -71,44 +87,106 @@ packages: dependency: "direct main" description: name: http - url: "https://pub.dartlang.org" + sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938" + url: "https://pub.dev" source: hosted - version: "0.12.2" + version: "1.2.1" http_parser: dependency: transitive description: name: http_parser - url: "https://pub.dartlang.org" + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + intl: + dependency: "direct main" + description: + name: intl + sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf + url: "https://pub.dev" + source: hosted + version: "0.19.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" + url: "https://pub.dev" + source: hosted + version: "10.0.0" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 + url: "https://pub.dev" + source: hosted + version: "2.0.1" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 + url: "https://pub.dev" + source: hosted + version: "2.0.1" + lints: + dependency: transitive + description: + name: lints + sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 + url: "https://pub.dev" source: hosted - version: "3.1.4" + version: "3.0.0" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.dev" source: hosted - version: "0.12.10-nullsafety" + version: "0.12.16+1" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + url: "https://pub.dev" + source: hosted + version: "0.8.0" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + url: "https://pub.dev" + source: hosted + version: "1.11.0" + nested: + dependency: transitive + description: + name: nested + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" + url: "https://pub.dev" source: hosted - version: "1.3.0-nullsafety.2" + version: "1.0.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" source: hosted - version: "1.8.0-nullsafety" - pedantic: - dependency: transitive + version: "1.9.0" + provider: + dependency: "direct main" description: - name: pedantic - url: "https://pub.dartlang.org" + name: provider + sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c + url: "https://pub.dev" source: hosted - version: "1.9.2" + version: "6.1.2" sky_engine: dependency: transitive description: flutter @@ -118,57 +196,82 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" source: hosted - version: "1.8.0-nullsafety" + version: "1.10.0" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" source: hosted - version: "1.10.0-nullsafety" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" source: hosted - version: "2.1.0-nullsafety" + version: "2.1.2" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.1.0-nullsafety" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted - version: "1.2.0-nullsafety" + version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + url: "https://pub.dev" source: hosted - version: "0.2.19-nullsafety" + version: "0.6.1" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" source: hosted - version: "1.3.0-nullsafety.2" + version: "1.3.2" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + url: "https://pub.dev" + source: hosted + version: "13.0.0" + web: + dependency: transitive + description: + name: web + sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" + url: "https://pub.dev" source: hosted - version: "2.1.0-nullsafety.2" + version: "0.5.1" sdks: - dart: ">=2.10.0-0.0.dev <2.10.0" + dart: ">=3.3.2 <4.0.0" + flutter: ">=1.16.0" diff --git a/NewsApp/pubspec.yaml b/NewsApp/pubspec.yaml index d350deb..1b30c4d 100644 --- a/NewsApp/pubspec.yaml +++ b/NewsApp/pubspec.yaml @@ -18,60 +18,62 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: ">=2.7.0 <3.0.0" + sdk: '>=3.3.2 <4.0.0' dependencies: - flutter: - sdk: flutter + 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.0 - http: ^0.12.2 + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.6 + http: ^1.2.1 + dio: ^5.4.2+1 + provider: ^6.1.2 + intl: ^0.19.0 dev_dependencies: - flutter_test: - sdk: flutter + flutter_test: + sdk: flutter -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec + # For information on the generic Dart part of this file, see the + # following page: https://dart.dev/tools/pub/pubspec + flutter_lints: ^3.0.0 # 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 - # 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 + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware. + # 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 + # 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 + # 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