Skip to content

Code structuring with Provider and GetIt packages #106

@remsysinc

Description

@remsysinc

Love the idea of this package! Coming from a Bootstrap environment on web to mobile, this concept is very appealing.

I'm using the Provider and GetIt packages and am having trouble configuring the main.dart code structure to integrate this package. My code is as follows and I'd like to see an example of how you'd add your package. I feel this inquiry could help a lot of people as Provider and GetIt seem to be extremely popular:

// This widget is the root of your application.
// Where/how to inject/add the ResponsiveFramework?
@OverRide
Widget build(BuildContext context) {
return MultiProvider(
providers: [
ChangeNotifierProvider(create: () => LoginViewModel()),
ChangeNotifierProvider(create: (
) => HomeViewModel()),
ChangeNotifierProvider(create: () => TestViewModel()),
StreamProvider(
initialData: InternetConnectionStatus.connected,
create: (
) => InternetConnectionChecker().onStatusChange),
],
builder: (context, child) {
return GetMaterialApp(
theme: ThemeData(
brightness: Brightness.light,
primaryColor: Colors.purple[800],
secondaryHeaderColor: Colors.cyan[600],
fontFamily: 'Verdana',
textTheme: const TextTheme(
headline1: TextStyle(fontSize: 50, fontWeight: FontWeight.bold),
headline6: TextStyle(fontSize: 30.0, fontStyle: FontStyle.italic),
bodyText2: TextStyle(fontSize: 18.0, fontFamily: 'Hind'),
),
),
debugShowCheckedModeBanner: false,
title: "My App",
home: WelcomeView(),
);
},
);
}

Any assistance is greatly appreciated! Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions