From 275c8afbc01075cea7256a9aa9af3745df977803 Mon Sep 17 00:00:00 2001 From: Jeremias Bulanadi Date: Sun, 12 Sep 2021 07:26:44 +0800 Subject: [PATCH] removed unnecessary imports and comments --- lib/main.dart | 3 - lib/pages/TESTnewsPage.dart | 167 ------------------------------------ lib/pages/mapPage.dart | 4 - lib/pages/wrapper.dart | 2 - lib/services/api_call.dart | 4 +- lib/services/geocoding.dart | 8 +- lib/widgets/news_list.dart | 1 - test/widget_test.dart | 1 - 8 files changed, 5 insertions(+), 185 deletions(-) delete mode 100644 lib/pages/TESTnewsPage.dart diff --git a/lib/main.dart b/lib/main.dart index f6a7b12..0c769d7 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -2,9 +2,6 @@ // A lot of these are made for prototyping // Most things will be changed -// TODO: -// - Make something that will inform if API isn't working - import 'package:flutter/material.dart'; import 'package:news_appdate/providers/news_provider.dart'; import 'package:provider/provider.dart'; diff --git a/lib/pages/TESTnewsPage.dart b/lib/pages/TESTnewsPage.dart deleted file mode 100644 index d631751..0000000 --- a/lib/pages/TESTnewsPage.dart +++ /dev/null @@ -1,167 +0,0 @@ -import 'package:flutter/material.dart'; -import '../models/aylien_data.dart'; - -class TESTNewsPage extends StatefulWidget { - const TESTNewsPage({Key? key}) : super(key: key); - - @override - _TESTNewsPageState createState() => _TESTNewsPageState(); -} - -class _TESTNewsPageState extends State { - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text('News Page'), - backgroundColor: Colors.green[400], - leading: IconButton( - icon: Icon(Icons.arrow_back), - onPressed: () => Navigator.of(context).pop(), - ), - actions: [ - Padding( - padding: EdgeInsets.only(right: 20.0), - child: Row( - children: [ - Padding( - padding: EdgeInsets.only(right: 15), - child: IconButton( - onPressed: () {}, - icon: Icon( - Icons.share, - size: 26.0, - ), - ), - ), - IconButton( - onPressed: () {}, - icon: Icon( - Icons.save, - size: 26.0, - )) - ], - )), - ], - ), - body: SingleChildScrollView( - padding: EdgeInsets.all(16), - child: Column( - children: [ - Padding( - padding: EdgeInsets.only(bottom: 25), - child: Align( - child: Text( - "Lorem Ipsum", - style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold), - ), - alignment: Alignment.centerLeft, - ), - ), - Padding( - padding: EdgeInsets.only(bottom: 25), - child: Image.asset('lib/assets/placeholder.jpg'), - ), - Padding( - padding: EdgeInsets.only(bottom: 25), - child: Text( - 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.')), - Padding( - padding: EdgeInsets.only(bottom: 25), - child: Align( - child: Row( - children: [ - Text( - '#Placeholder1', - style: TextStyle(color: Colors.blue), - ), - Text( - '#Placeholder2', - style: TextStyle(color: Colors.blue), - ), - Text( - '#Placeholder3', - style: TextStyle(color: Colors.blue), - ), - ], - ), - alignment: Alignment.centerLeft, - ), - ), - Align( - child: Column( - children: [ - Align( - child: Text( - 'Locations:', - style: TextStyle(color: Colors.black54), - ), - alignment: Alignment.centerLeft, - ), - Align( - child: Row( - children: [ - Text( - 'Placeholder1', - style: TextStyle(color: Colors.black54), - ), - SizedBox( - height: 18, - width: 18, - child: IconButton( - icon: Icon(Icons.location_searching_outlined, - size: 15), - onPressed: () {}), - ) - ], - ), - alignment: Alignment.centerLeft, - ), - Align( - child: Row( - children: [ - Text( - 'Placeholder2', - style: TextStyle(color: Colors.black54), - ), - SizedBox( - height: 18, - width: 18, - child: IconButton( - icon: Icon(Icons.location_searching_outlined, - size: 15), - onPressed: () {}), - ) - ], - ), - alignment: Alignment.centerLeft, - ), - Align( - child: Row( - children: [ - Text( - 'Placeholder3', - style: TextStyle(color: Colors.black54), - ), - SizedBox( - height: 18, - width: 18, - child: IconButton( - icon: Icon(Icons.location_searching_outlined, - size: 15), - onPressed: () {}), - ) - ], - ), - alignment: Alignment.centerLeft, - ) - ], - ), - alignment: Alignment.centerLeft, - ) - ], - ), - ), - ); - } -} diff --git a/lib/pages/mapPage.dart b/lib/pages/mapPage.dart index e58ea06..fba0307 100644 --- a/lib/pages/mapPage.dart +++ b/lib/pages/mapPage.dart @@ -3,14 +3,10 @@ import 'package:geolocator/geolocator.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:flutter/material.dart'; import 'package:location/location.dart' as loc; -import 'package:flutter/services.dart'; -import 'package:provider/provider.dart'; import '../models/aylien_data.dart'; import '../providers/news_provider.dart'; import 'newsPage.dart'; -import 'dart:async'; - // This is just for differentiating the markers put on the map enum NewsListType { locational, recommended, searched } diff --git a/lib/pages/wrapper.dart b/lib/pages/wrapper.dart index 609d1bd..885bc35 100644 --- a/lib/pages/wrapper.dart +++ b/lib/pages/wrapper.dart @@ -1,7 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; import 'messagePage.dart'; -import '../models/User.dart'; class Wrapper extends StatelessWidget { const Wrapper({Key? key}) : super(key: key); diff --git a/lib/services/api_call.dart b/lib/services/api_call.dart index c9f30c2..1640835 100644 --- a/lib/services/api_call.dart +++ b/lib/services/api_call.dart @@ -2,12 +2,10 @@ import '../constants/api_path.dart'; import '../models/aylien_data.dart'; +import '../models/aylien_trends.dart'; import 'dart:convert'; import 'package:http/http.dart' as http; -// TODO: -// - Do the wikipedia entry for location thing - Future fetchAylienNews(Map queryParameters) async { // The parameters for the GET request // this query is just for testing diff --git a/lib/services/geocoding.dart b/lib/services/geocoding.dart index 8a8e6ca..fd0b2a3 100644 --- a/lib/services/geocoding.dart +++ b/lib/services/geocoding.dart @@ -5,8 +5,6 @@ import 'package:location/location.dart' as LOC; // Gets user location details // we mostly just want: // ISO Country Code, Country, Subadministrative area, and the Locality -// TODO: -// - Actually implement getting user location instead of just testing geocoding // This is for testing, will be replaced Future getUserLocation() async { @@ -38,7 +36,8 @@ Future getLatLng(String location) async { try { List latlngs = await locationFromAddress(location); return latlngs[0]; - } on NoResultFoundException catch (e) { + } on NoResultFoundException catch (err) { + print(err); return null; } } @@ -51,7 +50,8 @@ Future getPlacemark(double? latitude, double? longitude) async { List placemarks = await placemarkFromCoordinates(latitude, longitude); return placemarks[0]; - } on PlatformException catch (e) { + } on PlatformException catch (err) { + print(err); return null; } } else { diff --git a/lib/widgets/news_list.dart b/lib/widgets/news_list.dart index f7fbcbe..fa786cd 100644 --- a/lib/widgets/news_list.dart +++ b/lib/widgets/news_list.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../providers/news_provider.dart'; -import '../models/aylien_data.dart'; import '../widgets/news_card.dart'; class NewsList extends StatefulWidget { diff --git a/test/widget_test.dart b/test/widget_test.dart index eb630a9..06c49af 100644 --- a/test/widget_test.dart +++ b/test/widget_test.dart @@ -7,7 +7,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:news_appdate/main.dart'; import 'package:news_appdate/pages/wrapper.dart'; void main() {