Reputation: 161
hi i am making an app for restaurant but i need some help i have a listtilel and i would like to save those values in memory or firebase anywhere i would like to get which topics selected how should i do that basicly i meant i want to get choosen datas from user and i would like to add it orders page if you have any suggestions please let me know thanks
import 'package:flutter/material.dart';
import 'package:resat/BurgerListView/data/toppics_model.dart';
import 'data/toppics.dart';
class decor extends StatefulWidget {
@override
MyAppState createState() {
return new MyAppState();
}
}
class MyAppState extends State<decor> {
List ketchup = [
'No',
'light',
'regular',
'extra',
];
List calori = ['0 Cal', '1 Cal', '2 Cal', '3 Cal'];
var i = 2;
final List<topics> _topics = categories;
@override
Widget build(BuildContext context) {
// TODO: implement build
return Container(
margin: EdgeInsets.all(6), //space between other listtiles
decoration: BoxDecoration(
border: Border.all(color: Colors.grey),
borderRadius: BorderRadius.all(Radius.circular(8))),
child: ListTile(
title: Row(children: [
Expanded(
child:
Text("Ketchup\n" + calori[i], textAlign: TextAlign.center,),),
Expanded(
child: (InkWell(
child: Text("-", textAlign: TextAlign.center),
onTap: () {
setState(() {
if (i <= 0){
i = i;
}else
i--;
print(i);
});
},
)),
),
Expanded(child: Text(ketchup[i], textAlign: TextAlign.center)),
Expanded(
child: (InkWell(
child: Text("+", textAlign: TextAlign.center),
onTap: () {
setState(() {
if (i > 2) {
i = i;
} else
i++;
print(i);
});
},
)),
),
]),
leading: Icon(Icons.pie_chart))
);
}
}
Upvotes: 2
Views: 617
Reputation: 7148
I can suggest you two ways to save your data across the different users.
Unsurprisingly it's an online database either via firebase or vis your own Web service APIs hosted on your server.
I don't suggest you offline database(SQLite) anyway because it will be limited to a single user.
The data you save and fetch will be limited to a single user.
So, try learning the flutter concepts from,
Upvotes: 2