Code Explained - The Terms List :
import 'package:flutter/material.dart';
import '../Pages/page.dart';
import '../Pages/termslist.dart';
class Terms1 extends StatelessWidget {
@override
Terms1();
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Unit One Terms'),
leading: new IconButton(
icon: new Icon(Icons.arrow_back),
color: Colors.white,
iconSize: 25.0,
onPressed: () => Navigator.of(context).pushAndRemoveUntil(new MaterialPageRoute(builder: (BuildContext context) => new TermsList()), (Route route) => route == null)
),
),
body: ListView.builder(
itemBuilder: (BuildContext context, int index) =>
EntryItem(data[index]),
itemCount: data.length,
),
),
);
}
}
// One entry in the multilevel list displayed by this app.
class Entry {
Entry(this.title, [this.children = const <Entry>[]]);
final String title;
final List<Entry> children;
}
// The entire multilevel list displayed by this app.
final List<Entry> data = <Entry>[
Entry(
'Social Contract Theory',
<Entry>[
Entry(
'People give up certain rights to the government in order to be protected',
),
],
),
Entry(
'John Locke',
<Entry>[
Entry(
'Wrote the Second Treatise on Government and established the idea of Inalienable Rights',
),
],
),
Entry(
'Inalienable Rights',
<Entry>[
Entry(
'A right that according to natural law cannot be taken away, denied or transferred. These are the rights to life, liberty, and property.',
),
],
),
Entry(
'Montesquieu',
<Entry>[
Entry(
'Wrote the Spirit of the Law and established the idea of Checks and Balances',
),
],
),
Entry(
'Machiavelli',
<Entry>[
Entry(
'Wrote the Prince and established the idea that it is better to be feared than loved',
),
],
),
Entry(
'Thomas Hobbes',
<Entry>[
Entry(
'Wrote the Leviathan and established the idea of the absolute power of the monarch by divine right',
),
],
),
Entry(
'Democracy',
<Entry>[
Entry(
'A system of government by the whole population or all the eligible members of a state',
),
],
),
Entry(
'Representative Democracy',
<Entry>[
Entry(
'Type of democracy in which citizens elect representatives who make up a legislature',
),
],
),
Entry(
'Minimalist Democracy',
<Entry>[
Entry(
'Type of democracy in which citizens elect political teams and give them the right to rule',
),
],
),
Entry(
'Direct Democracy',
<Entry>[
Entry(
'Type of democracy in which citizens cast their votes directly on laws,policies, and other legislative affairs',
),
],
),
Entry(
'Pluralism',
<Entry>[
Entry(
'A theory of government that a large and diverse array of groups compete for influence leading to the weakening state of the government',
),
],
),
Entry(
'Elitism',
<Entry>[
Entry(
'A theory of government that only those who have met the criteria for being elite may enter the political system',
),
],
),
Entry(
'Hyperpluralism',
<Entry>[
Entry(
'Pluralism to the extreme; Overwhelming amount of groups pull at the systems of power creates a gridlock',
),
],
),
Entry(
'Collective Goods',
<Entry>[
Entry(
'Goods and services that are by their nature cannot be denied to anyone',
),
],
),
Entry(
'Political Culture',
<Entry>[
Entry(
'An overall set of values widely shared within a society',
),
],
),
Entry(
'Politics',
<Entry>[
Entry(
'Process determining the leaders we select and the policies they pursue',
),
],
),
Entry(
'Public Policy',
<Entry>[
Entry(
'A choice that government makes in response to a political issue',
),
],
),
Entry(
'Linkage Institutions',
<Entry>[
Entry(
'Political Channels through which peoples concerns become political issues on the policy agenda',
),
],
),
Entry(
'New Jersey Plan',
<Entry>[
Entry(
'Called for equal representation in Congress',
),
],
),
Entry(
'Virginia Plan',
<Entry>[
Entry(
'Called for proportional representation in Congress',
),
],
),
Entry(
'Connecticut Compromise',
<Entry>[
Entry(
'AKA The Great Compromise, combined both the Virginia and New Jersey Plan to create a bicameral legislature with equal representation for the senate and proportional representaiton for the House of Representatives',
),
],
),
];
// Displays one Entry. If the entry has children then it's displayed
// with an ExpansionTile.
class EntryItem extends StatelessWidget {
const EntryItem(this.entry);
final Entry entry;
Widget _buildTiles(Entry root) {
if (root.children.isEmpty) return ListTile(title: Text(root.title));
return ExpansionTile(
key: PageStorageKey<Entry>(root),
title: Text(root.title),
children: root.children.map(_buildTiles).toList(),
);
}
@override
Widget build(BuildContext context) {
return _buildTiles(entry);
}
}
Code Explained - The Terms List :
import 'package:flutter/material.dart';
import '../Pages/page.dart';
import '../Pages/termslist.dart';
class Terms1 extends StatelessWidget {
@override
Terms1();
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Unit One Terms'),
leading: new IconButton(
icon: new Icon(Icons.arrow_back),
color: Colors.white,
iconSize: 25.0,
onPressed: () => Navigator.of(context).pushAndRemoveUntil(new MaterialPageRoute(builder: (BuildContext context) => new TermsList()), (Route route) => route == null)
),
),
body: ListView.builder(
itemBuilder: (BuildContext context, int index) =>
EntryItem(data[index]),
itemCount: data.length,
),
),
);
}
}
// One entry in the multilevel list displayed by this app.
class Entry {
Entry(this.title, [this.children = const <Entry>[]]);
final String title;
final List<Entry> children;
}
// The entire multilevel list displayed by this app.
final List<Entry> data = <Entry>[
Entry(
'Social Contract Theory',
<Entry>[
Entry(
'People give up certain rights to the government in order to be protected',
),
],
),
Entry(
'John Locke',
<Entry>[
Entry(
'Wrote the Second Treatise on Government and established the idea of Inalienable Rights',
),
],
),
Entry(
'Inalienable Rights',
<Entry>[
Entry(
'A right that according to natural law cannot be taken away, denied or transferred. These are the rights to life, liberty, and property.',
),
],
),
Entry(
'Montesquieu',
<Entry>[
Entry(
'Wrote the Spirit of the Law and established the idea of Checks and Balances',
),
],
),
Entry(
'Machiavelli',
<Entry>[
Entry(
'Wrote the Prince and established the idea that it is better to be feared than loved',
),
],
),
Entry(
'Thomas Hobbes',
<Entry>[
Entry(
'Wrote the Leviathan and established the idea of the absolute power of the monarch by divine right',
),
],
),
Entry(
'Democracy',
<Entry>[
Entry(
'A system of government by the whole population or all the eligible members of a state',
),
],
),
Entry(
'Representative Democracy',
<Entry>[
Entry(
'Type of democracy in which citizens elect representatives who make up a legislature',
),
],
),
Entry(
'Minimalist Democracy',
<Entry>[
Entry(
'Type of democracy in which citizens elect political teams and give them the right to rule',
),
],
),
Entry(
'Direct Democracy',
<Entry>[
Entry(
'Type of democracy in which citizens cast their votes directly on laws,policies, and other legislative affairs',
),
],
),
Entry(
'Pluralism',
<Entry>[
Entry(
'A theory of government that a large and diverse array of groups compete for influence leading to the weakening state of the government',
),
],
),
Entry(
'Elitism',
<Entry>[
Entry(
'A theory of government that only those who have met the criteria for being elite may enter the political system',
),
],
),
Entry(
'Hyperpluralism',
<Entry>[
Entry(
'Pluralism to the extreme; Overwhelming amount of groups pull at the systems of power creates a gridlock',
),
],
),
Entry(
'Collective Goods',
<Entry>[
Entry(
'Goods and services that are by their nature cannot be denied to anyone',
),
],
),
Entry(
'Political Culture',
<Entry>[
Entry(
'An overall set of values widely shared within a society',
),
],
),
Entry(
'Politics',
<Entry>[
Entry(
'Process determining the leaders we select and the policies they pursue',
),
],
),
Entry(
'Public Policy',
<Entry>[
Entry(
'A choice that government makes in response to a political issue',
),
],
),
Entry(
'Linkage Institutions',
<Entry>[
Entry(
'Political Channels through which peoples concerns become political issues on the policy agenda',
),
],
),
Entry(
'New Jersey Plan',
<Entry>[
Entry(
'Called for equal representation in Congress',
),
],
),
Entry(
'Virginia Plan',
<Entry>[
Entry(
'Called for proportional representation in Congress',
),
],
),
Entry(
'Connecticut Compromise',
<Entry>[
Entry(
'AKA The Great Compromise, combined both the Virginia and New Jersey Plan to create a bicameral legislature with equal representation for the senate and proportional representaiton for the House of Representatives',
),
],
),
];
// Displays one Entry. If the entry has children then it's displayed
// with an ExpansionTile.
class EntryItem extends StatelessWidget {
const EntryItem(this.entry);
final Entry entry;
Widget _buildTiles(Entry root) {
if (root.children.isEmpty) return ListTile(title: Text(root.title));
return ExpansionTile(
key: PageStorageKey<Entry>(root),
title: Text(root.title),
children: root.children.map(_buildTiles).toList(),
);
}
@override
Widget build(BuildContext context) {
return _buildTiles(entry);
}
}