Skip to content

Commit

Permalink
feat: POI Visit Screen completed with Image and description scraping
Browse files Browse the repository at this point in the history
  • Loading branch information
AritraBiswas9788 committed Jul 20, 2024
1 parent 6c7c467 commit 3da380b
Show file tree
Hide file tree
Showing 21 changed files with 1,532 additions and 227 deletions.
6 changes: 5 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.INTERNET"/>
Expand All @@ -23,6 +22,11 @@
<action android:name="android.speech.RecognitionService" />
</intent>
</queries>
<queries>
<intent>
<action android:name="android.intent.action.TTS_SERVICE" />
</intent>
</queries>
<supports-screens
android:largeScreens="true"
android:normalScreens="false"
Expand Down
Binary file added assets/icons/image_error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/orbit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/test.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/voices.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/lottie/imageloading.lottie
Binary file not shown.
Binary file added assets/lottie/orbit.lottie
Binary file not shown.
Binary file added assets/lottie/voice.lottie
Binary file not shown.
2 changes: 1 addition & 1 deletion lib/components/location_selector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ class _LocationSelectorState extends State<LocationSelector> {
try {
widget.tourController.isLoading.value = true;
widget.tourController.isError.value = false;
var out = await locationFromAddress("$selectedState,$selectedCountry").timeout(Duration(seconds: 10), onTimeout: (){
var out = await locationFromAddress("$selectedState,$selectedCountry").timeout(Duration(seconds: 25), onTimeout: (){
throw Exception("Location fetch timeout...");
});
print(out);
Expand Down
211 changes: 211 additions & 0 deletions lib/data_class/image_info.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
class ImageInfo {
String? batchcomplete;
Warnings? warnings;
Query? query;

ImageInfo({this.batchcomplete, this.warnings, this.query});

ImageInfo.fromJson(Map<String, dynamic> json) {
if (json["batchcomplete"] is String)
this.batchcomplete = json["batchcomplete"];
if (json["warnings"] is Map)
this.warnings =
json["warnings"] == null ? null : Warnings.fromJson(json["warnings"]);
if (json["query"] is Map)
this.query = json["query"] == null ? null : Query.fromJson(json["query"]);
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data["batchcomplete"] = this.batchcomplete;
if (this.warnings != null) data["warnings"] = this.warnings?.toJson();
if (this.query != null) data["query"] = this.query?.toJson();
return data;
}

@override
String toString() {
return 'WikiData(batchcomplete: $batchcomplete, warnings: $warnings, query: $query)';
}
}

class Query {
List<Normalized>? normalized;
Pages? pages;

Query({this.normalized, this.pages});

Query.fromJson(Map<String, dynamic> json) {
if (json["normalized"] is List)
this.normalized = json["normalized"] == null
? null
: (json["normalized"] as List)
.map((e) => Normalized.fromJson(e))
.toList();
if (json["pages"] is Map)
this.pages = json["pages"] == null ? null : Pages.fromJson(json["pages"]);
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.normalized != null)
data["normalized"] = this.normalized?.map((e) => e.toJson()).toList();
/*if (this.pages != null)
data["pages"] = this.pages?.toJson();*/
return data;
}

@override
String toString() {
return 'Query(normalized: $normalized, pages: $pages)';
}
}

class Pages {
String? pageID;
PageInfo? pageInfo;

Pages({this.pageID, this.pageInfo});

Pages.fromJson(Map<String, dynamic> json) {
for (Map<String, dynamic> page in json.values) {

/*if (page['pageid'] !=null) {
pageID = page['pageid'].toString();
pageInfo = PageInfo.fromJson(page);
}*/
pageInfo = PageInfo.fromJson(page);
}
}

@override
String toString() {
return 'Pages(pageID: $pageID, pageInfo: $pageInfo)';
}
}

class PageInfo {
int? pageid;
int? ns;
String? title;
String? thumbnail;
String? pageimage;
List<dynamic>? images;
String? imageLink;

PageInfo({this.pageid, this.ns, this.title, this.thumbnail});

PageInfo.fromJson(Map<String, dynamic> json) {
if (json["pageid"] is int) this.pageid = json["pageid"];
if (json["ns"] is int) this.ns = json["ns"];
if (json["title"] is String) this.title = json["title"];
if (json["extract"] is String) this.thumbnail = json["extract"];
if (json["pageimage"] is String) this.pageimage = json["pageimage"];
print(json['imageinfo']);
if (json["imageinfo"] is List<dynamic>) {
this.images = json["imageinfo"];
if(images!=null && images!.isNotEmpty)
{
Map<String,dynamic> imageJson = images![0];
String? imageUrl;
if(imageJson['thumburl'] is String)
imageUrl = imageJson['thumburl'];
if(imageJson['url'] is String)
imageUrl = imageJson['url'];
if(imageJson['responsiveUrls'] is Map<String, dynamic>)
{
Map<String,dynamic> iterList = imageJson['responsiveUrls'];
for(final item in iterList.values)
{
imageUrl = item;
}
}
imageLink = imageUrl;
}

}

}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data["pageid"] = this.pageid;
data["ns"] = this.ns;
data["title"] = this.title;
data["extract"] = this.thumbnail;
return data;
}

@override
String toString() {
return 'PageInfo(pageid: $pageid, ns: $ns, title: $title, extract: $thumbnail)';
}
}

class Normalized {
String? from;
String? to;

Normalized({this.from, this.to});

Normalized.fromJson(Map<String, dynamic> json) {
if (json["from"] is String) this.from = json["from"];
if (json["to"] is String) this.to = json["to"];
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data["from"] = this.from;
data["to"] = this.to;
return data;
}

@override
String toString() {
return 'Normalized(from: $from, to: $to)';
}
}

class Warnings {
Extracts? extracts;

Warnings({this.extracts});

Warnings.fromJson(Map<String, dynamic> json) {
if (json["extracts"] is Map)
this.extracts =
json["extracts"] == null ? null : Extracts.fromJson(json["extracts"]);
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.extracts != null) data["extracts"] = this.extracts?.toJson();
return data;
}

@override
String toString() {
return 'Warnings(extracts: $extracts)';
}
}

class Extracts {
String? info;

Extracts({this.info});

Extracts.fromJson(Map<String, dynamic> json) {
if (json["*"] is String) this.info = json["*"];
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data["*"] = this.info;
return data;
}

@override
String toString() {
return 'Extracts(info: $info)';
}
}
6 changes: 5 additions & 1 deletion lib/data_class/place_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ class PlaceInfo {
String category;
String name;

String? imageLink;
String? description;
String? wikiMediaTag;
String? wikipediaLang;
String? wikipediaTitle;
Expand All @@ -16,7 +18,9 @@ class PlaceInfo {
required this.label,
required this.address,
required this.category,
required this.name
required this.name,
this.description,
this.imageLink
});
@override
String toString() {
Expand Down
Loading

0 comments on commit 3da380b

Please sign in to comment.