import 'package:android/GlobalVariables.dart' as globals;
import 'package:easy_localization/easy_localization_delegate.dart';
import 'package:http/http.dart' as http;
import 'package:flutter/material.dart';
import 'package:localstorage/localstorage.dart';
class PainScore {
int id;
String name;
PainScore({this.id, this.name});
}
class Onlypain extends StatefulWidget {
@override
@override
_OnlypainState createState() => _OnlypainState();
}
class _OnlypainState extends State<Onlypain> {
List<PainScore> painScore = new List<PainScore>();
@override
void initState() {
super.initState();
painScore = [
new PainScore(id: 0, name: ' No Pain '),
new PainScore(id: 1, name: ''),
new PainScore(id: 2, name: ''),
new PainScore(id: 3, name: ''),
new PainScore(id: 4, name: 'Moderate Pain'),
new PainScore(id: 5, name: ''),
new PainScore(id: 6, name: ''),
new PainScore(id: 7, name: ''),
new PainScore(id: 8, name: ''),
new PainScore(id: 9, name: 'Worst Pain'),
];
}
bool pressAttention = false;
@override
Widget build(BuildContext context) {
LocalStorage score = new LocalStorage('score');
return Scaffold(
key: scaffoldKey,
appBar: AppBar(
title: Center(
child: Image.asset(
'image/asset/Logob.png',
width: 80,
height: 80,
),
),
),
body: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.all(5.0),
child: Container(
height: 25,
width: MediaQuery.of(context).size.width,
child: Center(
child: Text(
'Pain Score',
style: TextStyle(fontSize: 20),
),
),
),
),
///////////////////////////////////this is the button/////////////////////////////////////
Container(
height: MediaQuery.of(context).size.height / 2,
width: MediaQuery.of(context).size.width,
child: ListView(
padding: const EdgeInsets.all(20.0),
children: painScore.map((f) {
return Row(
children: <Widget>[
RaisedButton(
autofocus: true,
child: Text("Pain Score"),
textColor: Colors.white,
highlightColor: Colors.blue[50],
color:
pressAttention ? Colors.grey : globals.primaryColor,
onPressed: () {
setState(() {
var painScore = f.id.toString();
showInSnackBar("Pain Score is $painScore");
score.setItem('score', painScore);
pressAttention = !pressAttention;
});
}),
///////////////////////////////////this is the button/////////////////////////////////////
SizedBox(
width: 10,
),
Text(f.id.toString(),
style: new TextStyle(
fontSize: 11.0,
)),
SizedBox(
width: 10,
),
Image.asset(
'image/asset/iconblack.png',
width: 50,
height: 50,
),
SizedBox(
width: 10,
),
Text(
f.name,
style: new TextStyle(
fontSize: 15.0,
),
),
],
);
}).toList(),
),
),
],
),
persistentFooterButtons: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
RaisedButton.icon(
icon: Image.asset(
'image/asset/pads.png',
width: 15,
),
label: Text(AppLocalizations.of(context).tr('pads')),
textColor: Colors.white,
color: globals.primaryColor,
onPressed: () {
Navigator.pushReplacementNamed(context, '/pads');
},
),
RaisedButton.icon(
icon: Image.asset(
'image/asset/tampons.png',
width: 15,
),
label: Text(AppLocalizations.of(context).tr('tampon')),
textColor: Colors.white,
color: globals.primaryColor,
onPressed: () {
Navigator.pushReplacementNamed(context, '/tampons');
},
),
RaisedButton.icon(
icon: Image.asset(
'image/asset/pain.png',
width: 15,
),
label: Text(AppLocalizations.of(context).tr('Pain')),
textColor: Colors.white,
color: globals.primaryColor,
onPressed: () {},
),
RaisedButton(
child: Text(
"Submit",
style: TextStyle(fontSize: 13),
),
textColor: Colors.white,
color: globals.primaryColor,
onPressed: () async {
setState(() async {
showInSnackBar("Loading Wait");
await finaldata();
Navigator.pushReplacementNamed(context, '/home');
});
},
)
],
),
Container(
width: MediaQuery.of(context).size.width,
child: RaisedButton(
child: Text(AppLocalizations.of(context).tr('Cancel')),
textColor: Colors.white,
color: globals.primaryColor,
onPressed: () {
Navigator.pushReplacementNamed(context, '/afterCalender');
},
),
),
],
bottomNavigationBar: BottomNavigationBar(
onTap: (int index) {
setState(() {
_currentIndex = index;
//print(_children[_currentIndex]);
if (_currentIndex == 1) {
Navigator.pushReplacementNamed(context, '/menu');
} else if (_currentIndex == 2) {
Navigator.pushReplacementNamed(context, '/contact');
} else if (_currentIndex == 3) {
Navigator.pushReplacementNamed(context, '/setting');
} else {
Navigator.pushReplacementNamed(context, '/home');
}
});
},
currentIndex: _currentIndex,
items: <BottomNavigationBarItem>[
BottomNavigationBarItem(icon: Icon(Icons.home), title: Text('home')),
BottomNavigationBarItem(icon: Icon(Icons.menu), title: Text('menu')),
BottomNavigationBarItem(
icon: Icon(Icons.contacts), title: Text('contacts')),
BottomNavigationBarItem(
icon: Icon(Icons.settings), title: Text('settings'))
],
selectedItemColor: globals.primaryColor,
unselectedItemColor: Colors.blue[100],
),
);
}
}
пожалуйста, помогите выше код ...................................... .................................................. .................................................. ................... пожалуйста я свежее. Я должен сделать это за один час. Пожалуйста, помогите мне ...................................... .................................................. .................................................. ................