You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Am new in flutter and trying to get some basics from the flutterCrashCourse but unfortunately after completing the tourismandco,my LocationDetail only fetch the image with the exception of the TextContent and i would like to ask for help.
mixin MockLocation implements Location{
static final Listitems=[
Location(
id: 1,
name: 'X.com',
url:'https://cdn-images-1.medium.com/max/2000/1*vdJuSUKWl_SA9Lp-32ebnA.jpeg',
locationdata: [
LocationFact( title: 'Summary',
text:
'While we could go on about the ethereal glow and seemingly endless heights of this bamboo grove on the outskirts of Kyoto, the sight's pleasures extend beyond the visual realm'),
LocationFact( title: 'How to Get There',
text:
'Kyoto airport, with several terminals, is located 16 kilometres south of the city and is also known as Kyoto. Kyoto can also be reached by transport links from other regional airports.')
]
),
Location(
id: 2,
name: 'X.com',
url:'https://cdn-images-1.medium.com/max/2000/1*vdJuSUKWl_SA9Lp-32ebnA.jpeg',
locationdata: <LocationFact>[
LocationFact(title: 'Summary',
text:
'Japan’s Mt. Fuji is an active volcano about 100 kilometers southwest of Tokyo. Commonly called “Fuji-san,” it’s the country’s tallest peak, at 3,776 meters. A pilgrimage site for centuries, it’s considered one of Japan’s 3 sacred mountains, and summit hikes remain a popular activity. Its iconic profile is the subject of numerous works of art, notably Edo Period prints by Hokusai and Hiroshige.'),
LocationFact(title: 'Did You Know',
text:
'There are three cities that surround Mount Fuji: Gotemba, Fujiyoshida and Fujinomiya.')
]
),
Location(
id: 3,
name: 'Kiyomizu-dera',
url:
'https://media4.trover.com/T/5a97b80c8beb7fbf57002ffe/fixedw_large_4x.jpg',
locationdata: <LocationFact>[
LocationFact(
title: 'Summary',
text:
'Kiyomizu-dera, officially Otowa-san Kiyomizu-dera, is an independent Buddhist temple in eastern Kyoto. The temple is part of the Historic Monuments of Ancient Kyoto UNESCO World Heritage site.'),
LocationFact(
title: 'Architectural Style',
text: 'Japanese Buddhist architecture')
]),
Location(
id: 4,
name: 'Kinkaku-ji',
url:
'https://cdn-images-1.medium.com/max/1600/1*sncLZ1eNLYk3s-v76nJn8w.jpeg',
locationdata: <LocationFact>[
LocationFact(
title: 'Summary',
text:
'Kinkaku-ji, officially named Rokuon-ji, is a Zen Buddhist temple in Kyoto, Japan. It is one of the most popular buildings in Japan, attracting a large number of visitors annually.'),
LocationFact(
title: 'Did You Know',
text:
'The Golden Pavilion is set in a magnificent Japanese strolling garden.')
]),
Location(
id: 5,
name: 'Odaiba',
url:
'https://jp.openrice.com/userphoto/Article/0/1/0000CM2AF2F38CD85AB341j.jpg',
locationdata: <LocationFact>[
LocationFact(
title: 'Summary',
text:
'Accessed via the Rainbow Bridge or the futuristic Yurikamome train, Odaiba is a high-tech entertainment hub on an artificial island in Tokyo Bay. Visitors head to the beach at Seaside Park, enjoy Mt. Fuji views from the Daikanransha Ferris wheel, and interact with robots at the Miraikan science museum. Malls include Aqua City and the Venice-themed VenusFort, and there are sushi bars with views along the waterfront.'),
LocationFact(
title: 'Did You Know',
text:
'The pedestrian path begins a short walk from Shibaura-futo Station along the Yurikamome on the "Tokyo side" of the bridge, while Odaiba Kaihinkoen Station is the nearest station on the "Odaiba side."')
]),
Am new in flutter and trying to get some basics from the flutterCrashCourse but unfortunately after completing the tourismandco,my LocationDetail only fetch the image with the exception of the TextContent and i would like to ask for help.
//this is the LocationDetail Screen
import 'package:begining_fluttter_crash_course/models/Location.dart';
import 'package:begining_fluttter_crash_course/utitlities/constants.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class LocationData extends StatefulWidget {
final int locationID;
LocationData(this.locationID);
createState()=>_LocationDataState(this.locationID);
}
class _LocationDataState extends State{
final int locationID;
Location locations=Location.blank();
_LocationDataState(this.locationID);
void initState(){
super.initState();
NewData();
}
Widget build(BuildContext context){
return Scaffold(
appBar: AppBar(
title: Text(locations.name),
),
body: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: _renderBody(context,locations),
),
),
);
}
NewData()async {
final newid = await Location.fetchByID(this.locationID);
if (mounted) {
setState(() {
this.locations = newid;
});
}
}
List_renderBody(BuildContext context,Location location){
var result=[];
result.add(_bannerImage(location.url, 170));
result.addAll(_renderAny(context,location));
}
List _renderAny(BuildContext context,Location location) {
var ListContainer= [];
}
Widget _sectionTitle(String text){
return Container(
padding:EdgeInsets.all(10),
child: Text(text,style: KTextStyle,textAlign: TextAlign.left,));
}
Widget _sectionText(String text){
return Container
(
padding: EdgeInsets.all(20),
child: Text(text,
style:KTextStyle
)
);
}
Widget _bannerImage(String url,double height){
if(url.isEmpty){{
return Container();}
}
try{
return ClipRRect(
child: Image.network(url,fit: BoxFit.fitWidth,
height:height),
);
}
catch(e){
print('couldnt load image $url');
return Container();
}
}
}
//this is the MockLocationService
import 'package:begining_fluttter_crash_course/models/Location.dart';
import 'package:begining_fluttter_crash_course/models/LocationFact.dart';
mixin MockLocation implements Location{
static final Listitems=[
Location(
id: 1,
name: 'X.com',
url:'https://cdn-images-1.medium.com/max/2000/1*vdJuSUKWl_SA9Lp-32ebnA.jpeg',
locationdata: [
LocationFact( title: 'Summary',
text:
'While we could go on about the ethereal glow and seemingly endless heights of this bamboo grove on the outskirts of Kyoto, the sight's pleasures extend beyond the visual realm'),
LocationFact( title: 'How to Get There',
text:
'Kyoto airport, with several terminals, is located 16 kilometres south of the city and is also known as Kyoto. Kyoto can also be reached by transport links from other regional airports.')
]
),
];
static Location fetchAny(){
return MockLocation.items[0];
}
static List fetchAll(){
return MockLocation.items;
}
static Location fetch(int index){return MockLocation.items[index];
}
}
//this is the endpoint
class Endpoint{
static const apiScheme='http';
static const apiHost='fluttercrashcourse.com';
static const prefix='/api/v1';
static Uri uri(String path,{required Map<String,dynamic>queryParameters}){
final uri=new Uri(
scheme: apiScheme,
host: apiHost,
path: '$prefix$path',
queryParameters: queryParameters
);
return uri;
}
}
The text was updated successfully, but these errors were encountered: