вы можете сделать это с помощью XML http request ... вам просто нужно определить весь заголовок навигации, меню в одном файле и обратиться к одному div на всех страницах ...
<html>
<script>
function includeHTML() {
var z, i, elmnt, file, xhttp;
/*loop through a collection of all HTML elements:*/
z = document.getElementsByTagName("*");
for (i = 0; i < z.length; i++) {
elmnt = z[i];
/*search for elements with a certain atrribute:*/
file = elmnt.getAttribute("include-html");
if (file) {
/*make an HTTP request using the attribute value as the file name:*/
xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4) {
if (this.status == 200) {elmnt.innerHTML = this.responseText;}
if (this.status == 404) {elmnt.innerHTML = "Page not found.";}
/*remove the attribute, and call this function once more:*/
elmnt.removeAttribute("include-html");
includeHTML();
}
}
xhttp.open("GET", file, true);
xhttp.send();
/*exit the function:*/
return;
}
}
};
<script>
includeHTML();
</script>
</body>
</html>
Используйте ListView()
вместо Column()
, это может сработать.
ListView(
children: <Widget>[
new TextField(
controller: firstNameCtrlr,
keyboardType: TextInputType.text,
decoration: new InputDecoration(
labelText: 'Surname',
hintText: 'Paul',
icon: new Icon(Icons.person_add)),
),
new TextField(
controller: lastNameCtrlr,
keyboardType: TextInputType.text,
decoration: new InputDecoration(
labelText: 'name',
hintText: 'Ebuka',
icon: new Icon(Icons.person_pin_circle))),
new TextField(
controller: stateController,
keyboardType: TextInputType.text,
decoration: new InputDecoration(
labelText: 'State of Recidence',
hintText: 'Osun, Chicago e.t.c',
icon: new Icon(Icons.location_city))),
new TextField(
controller: languageController,
keyboardType: TextInputType.text,
decoration: new InputDecoration(
labelText: 'Official Language',
hintText: 'English, French',
icon: new Icon(Icons.language))),
new TextField(
controller: ageController,
keyboardType: TextInputType.number,
decoration: new InputDecoration(
labelText: 'Age',
hintText: 'e.g 70, 60',
icon: new Icon(Icons.person))),
new Padding(padding: new EdgeInsets.all(5.2)),
//calculate button
new Container(
alignment: Alignment.center,
child: new RaisedButton(
onPressed: () {},
color: Colors.pinkAccent,
child: new Text('Calculate'),
textColor: Colors.white,
),
Попробуйте этот код. Я изменил Столбец (над Фамилией Поля TextField) на ListView.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: new AppBar(
centerTitle: true,
backgroundColor: Colors.redAccent.shade200,
),
body: new Container(
alignment: Alignment.topCenter,
child: new ListView(
padding: const EdgeInsets.all(2.0),
children: <Widget>[
new Image.asset(
'assets/images/odddd.png',
height: 85.0,
width: 75.0,
),
new Container(
margin: const EdgeInsets.all(3.0),
height: 245.0,
width: 290.0,
color: Colors.grey.shade300,
child: new ListView(
children: <Widget>[
new TextField(
keyboardType: TextInputType.text,
decoration: new InputDecoration(
labelText: 'Surname',
hintText: 'Paul',
icon: new Icon(Icons.person_add)),
),
new TextField(
keyboardType: TextInputType.text,
decoration: new InputDecoration(
labelText: 'name',
hintText: 'Ebuka',
icon: new Icon(Icons.person_pin_circle))),
new TextField(
keyboardType: TextInputType.text,
decoration: new InputDecoration(
labelText: 'State of Recidence',
hintText: 'Osun, Chicago e.t.c',
icon: new Icon(Icons.location_city))),
new TextField(
keyboardType: TextInputType.text,
decoration: new InputDecoration(
labelText: 'Official Language',
hintText: 'English, French',
icon: new Icon(Icons.language))),
new TextField(
keyboardType: TextInputType.number,
decoration: new InputDecoration(
labelText: 'Age',
hintText: 'e.g 70, 60',
icon: new Icon(Icons.person))),
new Padding(padding: new EdgeInsets.all(5.2)),
//calculate button
new Container(
alignment: Alignment.center,
child: new RaisedButton(
onPressed: () {},
color: Colors.pinkAccent,
child: new Text('Calculate'),
textColor: Colors.white,
),
),
],
),
),
],
),
),
),
);
}
}