创建 Flutter 购物车
我想在我的应用程序中制作一个购物车, 我可以有一些关于如何做到这一点的资源吗?
我所有的手表都是旧的,不是我想要的 这是使用 Firebase 和 Provider
这是模型:
class Summer_d {
late String Imag;
late String info;
late String name;
late int price;
late String sub_info;
late List<dynamic>? sub_img;
Summer_d.fromMap(Map<String,dynamic>data){
Imag = data["Imag"];
info = data ["info"];
name = data ["name"];
price = data["price"];
sub_info = data ["sub_info"];
sub_img = data ["sub_img"];
}
}
这是 Provider 类
class SummerNotifier with ChangeNotifier {
List<Summer_d> _summerList = [];
late Summer_d _currentsummer;
int slectedIndex = 0;
UnmodifiableListView<Summer_d> get summerList =>
UnmodifiableListView(_summerList);
Summer_d get currentsummer => _currentsummer;
set summerList(List<Summer_d> summerList) {
_summerList = summerList;
notifyListeners();
}
set currentsummer(Summer_d summer_d) {
_currentsummer = summer_d;
notifyListeners();
}
}
I want to make a Shopping Cart in my App ,
can i have some sources on how to do it ?
All i have watch is old and not what i want
which is to use Firebase and Provider
This is the model:
class Summer_d {
late String Imag;
late String info;
late String name;
late int price;
late String sub_info;
late List<dynamic>? sub_img;
Summer_d.fromMap(Map<String,dynamic>data){
Imag = data["Imag"];
info = data ["info"];
name = data ["name"];
price = data["price"];
sub_info = data ["sub_info"];
sub_img = data ["sub_img"];
}
}
This is the Provider class
class SummerNotifier with ChangeNotifier {
List<Summer_d> _summerList = [];
late Summer_d _currentsummer;
int slectedIndex = 0;
UnmodifiableListView<Summer_d> get summerList =>
UnmodifiableListView(_summerList);
Summer_d get currentsummer => _currentsummer;
set summerList(List<Summer_d> summerList) {
_summerList = summerList;
notifyListeners();
}
set currentsummer(Summer_d summer_d) {
_currentsummer = summer_d;
notifyListeners();
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论