Skip to content

Commit

Permalink
fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
taras-git committed Feb 15, 2020
2 parents 4312439 + e3e4e03 commit 8cf6608
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 60 deletions.
88 changes: 45 additions & 43 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:openflutterecommerce/config/routes.dart';
import 'package:openflutterecommerce/config/theme.dart';
import 'package:openflutterecommerce/screens/categories/categories_screen.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_translate/flutter_translate.dart';
import 'package:openflutterecommerce/screens/home/home_screen.dart';
import 'package:openflutterecommerce/screens/signin/forget_password.dart';
import 'package:openflutterecommerce/screens/signin/signup.dart';
import 'package:openflutterecommerce/screens/splash_screen.dart';

import 'authentication/authentication.dart';
import 'config/routes.dart';
import 'screens/home/home_screen.dart';
Expand Down Expand Up @@ -37,17 +38,19 @@ class SimpleBlocDelegate extends BlocDelegate {
}

void main() async {
var delegate = await LocalizationDelegate.create(
fallbackLocale: 'en_US',
supportedLocales: ['en_US', 'de'],
);

WidgetsFlutterBinding.ensureInitialized();
BlocSupervisor.delegate = SimpleBlocDelegate();
var delegate = await LocalizationDelegate.create(
fallbackLocale: 'en_US', supportedLocales: ['en_US', 'de']);
runApp(BlocProvider<AuthenticationBloc>(
create: (context) => AuthenticationBloc()..add(AppStarted()),
child: LocalizedApp(
delegate,
OpenFlutterEcommerceApp(),
),
));
create: (context) => AuthenticationBloc()..add(AppStarted()),
child: LocalizedApp(
delegate,
OpenFlutterEcommerceApp(),
)));
}

class OpenFlutterEcommerceApp extends StatelessWidget {
Expand All @@ -71,39 +74,38 @@ class OpenFlutterEcommerceApp extends StatelessWidget {
var localizationDelegate = LocalizedApp.of(context).delegate;

return LocalizationProvider(
state: LocalizationProvider.of(context).state,
child: MaterialApp(
title: 'Open FLutter E-commerce',
localizationsDelegates: [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
localizationDelegate
],
supportedLocales: localizationDelegate.supportedLocales,
locale: localizationDelegate.currentLocale,
theme: OpenFlutterEcommerceTheme.of(context),
routes: <String, WidgetBuilder>{
OpenFlutterEcommerceRoutes.home: (context) => HomeScreen(),
OpenFlutterEcommerceRoutes.cart: (context) => HomeScreen(),
OpenFlutterEcommerceRoutes.favourites: (context) => HomeScreen(),
OpenFlutterEcommerceRoutes.SIGNIN: (context) => _signIn,
OpenFlutterEcommerceRoutes.SIGNUP: (context) => _signUp,
OpenFlutterEcommerceRoutes.FORGET_PASSWORD: (context) =>
_forgetPassword,
OpenFlutterEcommerceRoutes.shop: (context) => CategoriesScreen(),
OpenFlutterEcommerceRoutes.profile: (context) =>
BlocBuilder<AuthenticationBloc, AuthenticationState>(
builder: (context, state) {
if (state is Authenticated) {
return HomeScreen(); //TODO profile properties should be here
} else if (state is Unauthenticated) {
return _signUp;
} else {
return SplashScreen();
}
}),
},
),
);
state: LocalizationProvider.of(context).state,
child: MaterialApp(
localizationsDelegates: [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
localizationDelegate,
],
supportedLocales: localizationDelegate.supportedLocales,
locale: localizationDelegate.currentLocale,
title: 'Open FLutter E-commerce',
theme: OpenFlutterEcommerceTheme.of(context),
routes: <String, WidgetBuilder>{
OpenFlutterEcommerceRoutes.home: (context) => HomeScreen(),
OpenFlutterEcommerceRoutes.cart: (context) => HomeScreen(),
OpenFlutterEcommerceRoutes.favourites: (context) => HomeScreen(),
OpenFlutterEcommerceRoutes.SIGNIN: (context) => _signIn,
OpenFlutterEcommerceRoutes.SIGNUP: (context) => _signUp,
OpenFlutterEcommerceRoutes.FORGET_PASSWORD: (context) =>
_forgetPassword,
OpenFlutterEcommerceRoutes.shop: (context) => CategoriesScreen(),
OpenFlutterEcommerceRoutes.profile: (context) =>
BlocBuilder<AuthenticationBloc, AuthenticationState>(
builder: (context, state) {
if (state is Authenticated) {
return HomeScreen(); //TODO profile properties should be here
} else if (state is Unauthenticated) {
return _signUp;
} else {
return SplashScreen();
}
}),
},
));
}
}
34 changes: 18 additions & 16 deletions lib/screens/home/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class _HomeScreenState extends State<HomeScreen> {
@override
Widget build(BuildContext context) {
return SafeArea(
child: OpenFlutterScaffold(
child: OpenFlutterScaffold(
background: null,
title: null,
body: BlocProvider<HomeBloc>(
Expand All @@ -47,20 +47,22 @@ class _HomeWrapperState extends OpenFlutterWrapperState<HomeWrapper> {
Widget build(BuildContext context) {
return BlocBuilder<HomeBloc, HomeState>(
builder: (BuildContext context, HomeState state) {
return getPageView(<Widget>[
Main1View(
changeView: changePage,
products:
state is HomeLoadedState ? state.newProducts : List<Product>()),
Main2View(
changeView: changePage,
salesProducts: state is HomeLoadedState
? state.salesProducts
: List<Product>(),
newProducts:
state is HomeLoadedState ? state.newProducts : List<Product>()),
Main3View(changeView: changePage)
]);
});
return getPageView(<Widget>[
Main1View(
changeView: changePage,
products: state is HomeLoadedState
? state.newProducts
: List<Product>()),
Main2View(
changeView: changePage,
salesProducts: state is HomeLoadedState
? state.salesProducts
: List<Product>(),
newProducts: state is HomeLoadedState
? state.newProducts
: List<Product>()),
Main3View(changeView: changePage)
]);
});
}
}
1 change: 0 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ dependencies:
sdk: flutter
flutter_localizations:
sdk: flutter
# flutter_cupertino_localizations: ^1.0.1

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
Expand Down

0 comments on commit 8cf6608

Please sign in to comment.