Samaritan1011001 / Trovami

A live location sharing app built on Flutter and Firebase as backend
255 stars 109 forks source link

Set up provider in the app #19

Open Samaritan1011001 opened 3 years ago

Samaritan1011001 commented 3 years ago

Following the managers/helpers/model architecture, add initial provider set up to the app

https://blog.codemagic.io/flutter-tutorial-app-arhitecture-beginners/ https://pub.dev/packages/provider https://flutter.dev/docs/development/data-and-backend/state-mgmt/simple

muhammed-amein commented 3 years ago

hey @Samaritan1011001 can you look at this, i've been stuck here for a while https://t.co/T3yVelwSff?amp=1

Samaritan1011001 commented 3 years ago

@muhammed-amein I don't have enough reputation on SO to comment on the question so I'll ask here. You have two MaterialApps. May I ask why?

You can try giving the Provider to the ListTile instead of in the beginning like this

ChangeNotifierProvider(
      create: (context)=>AppData(),
      child: ListTile(
        leading: Icon(Icons.local_taxi_outlined),
        title: Text("My Gooshs".tr().toString()),
        onTap: () {
          Navigator.push(context,
              MaterialPageRoute(builder: (context) => HistoryScreen()));
        },
      ),
    )

Also, you can use a simple Provider instead of MultiProvider since you only have one Provider to pass on.