developed

This commit is contained in:
komekh 2023-10-27 10:17:33 +05:00
parent d43b0d54fe
commit 73df6a1bea
41 changed files with 172 additions and 76 deletions

View File

@ -51,10 +51,9 @@ android {
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.elektronika.tm"
minSdkVersion 21 //TODO: Change to 16 in production
targetSdkVersion 31
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}

View File

@ -30,19 +30,19 @@
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
<!-- <meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
/> -->
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
<!-- <meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
/> -->
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 B

After

Width:  |  Height:  |  Size: 69 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 B

After

Width:  |  Height:  |  Size: 69 B

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:forceDarkAllowed">false</item>
<item name="android:windowFullscreen">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>

View File

@ -5,6 +5,10 @@
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
<item name="android:forceDarkAllowed">false</item>
<item name="android:windowFullscreen">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your

View File

@ -4,7 +4,8 @@
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:forceDarkAllowed">false</item>
<item name="android:windowFullscreen">false</item>
<item name="android:windowSplashScreenBackground">#ffffff</item>
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your

View File

@ -7,6 +7,8 @@
<item name="android:windowBackground">@drawable/launch_background</item>
<item name="android:forceDarkAllowed">false</item>
<item name="android:windowFullscreen">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 B

After

Width:  |  Height:  |  Size: 69 B

View File

@ -5,48 +5,15 @@
"idiom" : "universal",
"scale" : "1x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "LaunchImageDark.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "LaunchImage@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "LaunchImageDark@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "LaunchImage@3x.png",
"idiom" : "universal",
"scale" : "3x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "LaunchImageDark@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

View File

@ -16,4 +16,6 @@ class Constants {
static const USER_NAME = 'user_name';
static const CART_LIST = 'cart_list';
static const LOCALE = 'locale';
static const IS_SPLASH_SEEN = 'is_splash_seen';
static const IS_SPLASH_REMOVED = 'is_splash_removed';
}

View File

@ -1,5 +1,9 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter_native_splash/flutter_native_splash.dart';
import 'package:get/get.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../../app.dart';
class DashboardController extends GetxController with GetSingleTickerProviderStateMixin {
late AnimationController animationController;
@ -12,7 +16,7 @@ class DashboardController extends GetxController with GetSingleTickerProviderSta
@override
void onInit() {
animationController = AnimationController(vsync: this, duration: Duration(milliseconds: 300), value: 1);
_init();
super.onInit();
}
@ -22,6 +26,20 @@ class DashboardController extends GetxController with GetSingleTickerProviderSta
super.dispose();
}
Future<void> _init() async {
FlutterNativeSplash.remove();
animationController = AnimationController(vsync: this, duration: Duration(milliseconds: 300), value: 1);
SharedPreferences prefs = await SharedPreferences.getInstance();
final bool isRemoved = prefs.getBool(Constants.IS_SPLASH_REMOVED) ?? false;
if (isRemoved) {
prefs.setBool(Constants.IS_SPLASH_REMOVED, true);
} else {
FlutterNativeSplash.remove();
}
}
// Hide bottom navbar on scroll down
/* bool handleScrollNotification(ScrollNotification notification) {
if (notification.depth == 0) {

View File

@ -1,11 +1,20 @@
import 'package:flutter/material.dart';
import 'package:flutter_native_splash/flutter_native_splash.dart';
import 'package:get/get.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../../app.dart';
class LangSplashController extends GetxController {
RxBool isTurkmen = true.obs;
@override
void onInit() {
FlutterNativeSplash.remove();
super.onInit();
}
void onLangBtnTapped(isTurkmenSelected) {
isTurkmen.value = isTurkmenSelected;
final langCode = isTurkmen.value ? 'tm' : 'ru';
@ -14,8 +23,13 @@ class LangSplashController extends GetxController {
setLocale(langCode);
}
void onNextBtnTapped() {
Future<void> onNextBtnTapped() async {
debugPrint('onNextBtnTapped');
SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.setBool(Constants.IS_SPLASH_SEEN, true);
prefs.setBool(Constants.IS_SPLASH_REMOVED, true);
Get.offAndToNamed(AppRoutes.DASHBOARD);
}
}

View File

@ -3,6 +3,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_native_splash/flutter_native_splash.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'app/app.dart';
import 'app/core/utils/notification_service.dart';
@ -10,9 +11,9 @@ import 'app/core/utils/notification_service.dart';
DBHelper dbHelper = DBHelper();
Future<void> _initAppInitials() async {
WidgetsFlutterBinding.ensureInitialized();
// HttpOverrides.global = MyHttpOverrides();
WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
await ScreenUtil.ensureScreenSize();
@ -31,25 +32,30 @@ Future<void> _initFBInitials() async {
Future<void> main() async {
await _initAppInitials();
final String locale = await getLocale();
FlutterNativeSplash.remove();
// FB functions needs to init after
/// [FlutterNativeSplash.remove()]
await _initFBInitials();
runApp(ElektronikaShopApp(lang: locale));
SharedPreferences prefs = await SharedPreferences.getInstance();
final bool isSeen = prefs.getBool(Constants.IS_SPLASH_SEEN) ?? false;
final String locale = await getLocale();
runApp(ElektronikaShopApp(
lang: locale,
isSplashSeen: isSeen,
));
}
class ElektronikaShopApp extends StatelessWidget {
final String? lang;
final String lang;
final bool isSplashSeen;
ElektronikaShopApp({required this.lang});
ElektronikaShopApp({
required this.lang,
required this.isSplashSeen,
});
@override
Widget build(BuildContext context) {
debugPrint('LANG =>>> $lang');
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
@ -59,10 +65,10 @@ class ElektronikaShopApp extends StatelessWidget {
return ScreenUtilInit(
designSize: Size(constraints.maxWidth, constraints.maxHeight),
builder: (_, child) => GetMaterialApp(
initialRoute: lang == null ? AppRoutes.SPLASH : AppRoutes.DASHBOARD,
initialRoute: isSplashSeen ? AppRoutes.DASHBOARD : AppRoutes.SPLASH,
getPages: AppPages.list,
debugShowCheckedModeBanner: false,
locale: lang == null ? Locale('tm', 'TM') : Locale(lang!, lang!.toUpperCase()),
locale: Locale(lang, lang.toUpperCase()),
fallbackLocale: LocalizationService.fallbackLocale,
translations: LocalizationService(),
theme: AppTheme.light,

View File

@ -3,7 +3,7 @@ description: elektronika project online shopping platform.
publish_to: "none" # Remove this line if you wish to publish to pub.dev
version: 2.0.2+7
version: 2.0.5+11
environment:
sdk: ">=2.12.0 <3.0.0"
@ -12,7 +12,7 @@ dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
flutter_screenutil: ^5.5.3+2
flutter_screenutil: ^5.9.0
get: ^4.6.5
flutter_svg: ^2.0.7
badges: ^3.1.2
@ -48,7 +48,7 @@ dependencies:
firebase_messaging: ^14.1.1
firebase_core: ^2.3.0
flutter_local_notifications: ^16.1.0
flutter_native_splash: ^2.2.0+1
flutter_native_splash: ^2.3.4
dev_dependencies:
flutter_test:

View File

@ -1,6 +1,4 @@
<!DOCTYPE html>
<html>
<head>
<!DOCTYPE html><html><head>
<!--
If you are serving your web app in a path other than the root, change the
href value below to reflect the base path you are serving from.
@ -28,16 +26,82 @@
<title>elektronika</title>
<link rel="manifest" href="manifest.json">
<script src="splash/splash.js"></script>
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport"/>
<link rel="stylesheet" type="text/css" href="splash/style.css">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
<style id="splash-screen-style">
html {
height: 100%
}
body {
margin: 0;
min-height: 100%;
background-color: #ffffff;
background-size: 100% 100%;
}
.center {
margin: 0;
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.contain {
display:block;
width:100%; height:100%;
object-fit: contain;
}
.stretch {
display:block;
width:100%; height:100%;
}
.cover {
display:block;
width:100%; height:100%;
object-fit: cover;
}
.bottom {
position: absolute;
bottom: 0;
left: 50%;
-ms-transform: translate(-50%, 0);
transform: translate(-50%, 0);
}
.bottomLeft {
position: absolute;
bottom: 0;
left: 0;
}
.bottomRight {
position: absolute;
bottom: 0;
right: 0;
}
</style>
<script id="splash-screen-script">
function removeSplashFromWeb() {
document.getElementById("splash")?.remove();
document.getElementById("splash-branding")?.remove();
document.body.style.background = "transparent";
}
</script>
</head>
<body>
<picture id="splash">
<source srcset="splash/img/light-1x.png 1x, splash/img/light-2x.png 2x, splash/img/light-3x.png 3x, splash/img/light-4x.png 4x" media="(prefers-color-scheme: light)">
<source srcset="splash/img/dark-1x.png 1x, splash/img/dark-2x.png 2x, splash/img/dark-3x.png 3x, splash/img/dark-4x.png 4x" media="(prefers-color-scheme: dark)">
<img class="center" aria-hidden="true" src="splash/img/light-1x.png" alt=""/>
<img class="center" aria-hidden="true" src="splash/img/light-1x.png" alt="">
</picture>
<!-- This script installs service_worker.js to provide PWA functionality to
application. For more information, see:
https://developers.google.com/web/fundamentals/primers/service-workers -->
@ -105,5 +169,5 @@
loadMainDartJs();
}
</script>
</body>
</html>
</body></html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB