You can copy paste run full code below
You can use nested ListView.separated
code snippet
ListView.separated(
separatorBuilder: (BuildContext context, int index) {
return SizedBox(
height: 10,
);
},
shrinkWrap: true,
itemCount: null == _continent ? 0 : _continent.length,
itemBuilder: (context, index) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Expanded(
flex: 1, child: Text(_continent[index].continent)),
Expanded(
flex: 2,
child: Container(
height: 50,
child: ListView.separated(
separatorBuilder:
It's too long to describe all the detail, you can directly reference full code
working demo

full code
import 'package:flutter/material.dart';
// To parse this JSON data, do
//
// final continent = continentFromJson(jsonString);
import 'dart:convert';
List<Continent> continentFromJson(String str) =>
List<Continent>.from(json.decode(str).map((x) => Continent.fromJson(x)));
String continentToJson(List<Continent> data) =>
json.encode(List<dynamic>.from(data.map((x) => x.toJson())));
class Continent {
Continent({
this.id,
this.continent,
this.country,
});
int id;
String continent;
List<Country> country;
factory Continent.fromJson(Map<String, dynamic> json) => Continent(
id: json["id"],
continent: json["continent"],
country:
List<Country>.from(json["country"].map((x) => Country.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"id": id,
"continent": continent,
"country": List<dynamic>.from(country.map((x) => x.toJson())),
};
}
class Country {
Country({
this.name,
this.capital,
this.language,
});
String name;
String capital;
List<String> language;
factory Country.fromJson(Map<String, dynamic> json) => Country(
name: json["name"],
capital: json["capital"],
language: List<String>.from(json["language"].map((x) => x)),
);
Map<String, dynamic> toJson() => {
"name": name,
"capital": capital,
"language": List<dynamic>.from(language.map((x) => x)),
};
}
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class ContinentServices {
Future<List<Continent>> getContinent() {
String jsonString = '''
[
{
"id": 1,
"continent": "North America",
"country": [
{
"name": "United States",
"capital": "Washington, D.C.",
"language": [
"English"
]
},
{
"name": "Canada",
"capital": "Ottawa",
"language": [
"English",
"French"
]
}
]
},
{
"id": 2,
"continent": "Europe",
"country": [
{
"name": "Germany",
"capital": "Berlin",
"language": [
"German"
]
}
]
}
]
''';
List<Continent> continentList = continentFromJson(jsonString);
return Future.value(continentList);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
List<Continent> _continent;
@override
void initState() {
super.initState();
ContinentServices().getContinent().then((continents) {
setState(() {
_continent = continents;
});
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: ListView.separated(
separatorBuilder: (BuildContext context, int index) {
return SizedBox(
height: 10,
);
},
shrinkWrap: true,
itemCount: null == _continent ? 0 : _continent.length,
itemBuilder: (context, index) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Expanded(
flex: 1, child: Text(_continent[index].continent)),
Expanded(
flex: 2,
child: Container(
height: 50,
child: ListView.separated(
separatorBuilder:
(BuildContext context, int index) {
return SizedBox(
width: 10,
);
},
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: null == _continent
? 0
: _continent[index].country.length,
itemBuilder: (context, countryIndex) {
print(_continent[index]
.country[countryIndex]
.name);
return Row(
mainAxisAlignment:
MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.center,
children: <Widget>[
Container(
width: 120,
child: Column(
children: <Widget>[
Text(
_continent[index]
.country[countryIndex]
.name,
style: TextStyle(
color: Colors.red),
),
Text(
_continent[index]
.country[countryIndex]
.capital,
style: TextStyle(
color: Colors.red)),
Expanded(
child: ListView.separated(
separatorBuilder:
(BuildContext context,
int index) {
return SizedBox(
width: 2,
);
},
shrinkWrap: true,
scrollDirection:
Axis.horizontal,
itemCount: null ==
_continent
? 0
: _continent[index]
.country[
countryIndex]
.language
.length,
itemBuilder: (context,
languageIndex) {
return Row(
mainAxisAlignment:
MainAxisAlignment
.spaceEvenly,
children: <Widget>[
Text(
_continent[index]
.country[
countryIndex]
.language[
languageIndex],
style: TextStyle(
color: Colors
.red)),
]);
}),
),
],
),
)
]);
}),
),
)
])
],
);
}));
}
}