foop_loyalty_plugin 0.4.1 foop_loyalty_plugin: ^0.4.1 copied to clipboard
A loyalty management tool
foop_loyalty_plugin #
A loyalty management tool
Getting Started #
This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.
For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.
// add these two plugin in your pubspec.yaml // flutter_bloc: ^8.0.0 required for clean architecture
// responsive_framework: ^0.1.7 required for rsponsiveness of plugin
void main() { runApp(MainApp());
// step 1 setupRewardsLocator();
}
class MainApp extends StatefulWidget {
// step 2, a function for localization static Future
MyApp createState() => MyApp(); }
class MyApp extends State
// step 3 Locale? _locale; void setLocale(Locale locale) { setState(() { _locale = locale; }); }
@override // ignore: missing_return initState() { super.initState();
//step 4 set initial values fo localization
if (_locale == null) {
setLocale(const Locale("en",
"IN"));
}
} // This widget is the root of your application. @override Widget build(BuildContext context) {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: HexColor(AppColors.appColorTransparent),
statusBarBrightness: Brightness.dark,
statusBarIconBrightness: Brightness.dark));
return MaterialApp(
home: const MyHomePage(title: 'Flutter Demo Home Page'),
// step 5 for responsive behaviour add ResponsiveWrapper
builder: (context, widget) => ResponsiveWrapper.builder(
BouncingScrollWrapper.builder(context, widget!),
maxWidth: 1200,
minWidth: 450,
defaultScale: true,
breakpoints: [
ResponsiveBreakpoint.resize(450, name: MOBILE),
ResponsiveBreakpoint.autoScale(800, name: TABLET),
ResponsiveBreakpoint.autoScale(1000, name: TABLET),
ResponsiveBreakpoint.resize(1200, name: DESKTOP),
ResponsiveBreakpoint.autoScale(2460, name: "4K"),
],
background: Container(
color: HexColor(AppColors.appColorBackground),
),
),
//step 6
locale: _locale,
themeMode: ThemeMode.light,
//step 7 supportedLocales: const [ Locale("en", "US"), Locale("hi", "IN"), Locale("ta", "IN"), Locale("te", "IN"), Locale("ur", "IN"), ],
//step 8
localizationsDelegates: const [
AppLocalizations.delegate,
],
// Returns a locale which will be used by the app
localeResolutionCallback: (locale, supportedLocales) {
// Check if the current device locale is supported
for (var supportedLocale in supportedLocales) {
if (supportedLocale.languageCode == locale!.languageCode &&
supportedLocale.countryCode == locale.countryCode) {
return supportedLocale;
}
}
// If the locale of the device is not supported, use the first one
// from the list (English, in this case).
return supportedLocales.first;
},
debugShowCheckedModeBanner: false,
);
} }
class MyHomePage extends StatefulWidget { const MyHomePage({Key? key, required this.title}) : super(key: key);
// This widget is the home page of your application. It is stateful, meaning // that it has a State object (defined below) that contains fields that affect // how it looks.
// This class is the configuration for the state. It holds the values (in this // case the title) provided by the parent (in this case the App widget) and // used by the build method of the State. Fields in a Widget subclass are // always marked "final".
final String title;
@override State
class _MyHomePageState extends State
void _incrementCounter() {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => BlocProvider(
create: (_) => CubitMain(),
child: ManageRewardsPage(
appLanguageCode: "en",
dateFormat: 'dd-MMM-yyyy',
timeFormat: "HH:mm",
baseUrlWithoutHttp: "test.foop.com",
googleTranslationKey: "Google key for translation",
businessId: 1638510830197,
userImage: "/media/person/profile/1638510631340/1646897564696_2927.jpg",
userName: "userName",
userId: "userID",
token: "Token",
baseUrl:"https://test.foop.com",
),
),
));
}
@override Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
return Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
body: Center(
// Center is a layout widget. It takes a single child and positions it
// in the middle of the parent.
child: Column(
// Column is also a layout widget. It takes a list of children and
// arranges them vertically. By default, it sizes itself to fit its
// children horizontally, and tries to be as tall as its parent.
//
// Invoke "debug painting" (press "p" in the console, choose the
// "Toggle Debug Paint" action from the Flutter Inspector in Android
// Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
// to see the wireframe for each widget.
//
// Column has various properties to control how it sizes itself and
// how it positions its children. Here we use mainAxisAlignment to
// center the children vertically; the main axis here is the vertical
// axis because Columns are vertical (the cross axis would be
// horizontal).
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headline4,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
} }