Skip to content

Commit

Permalink
Merge branch 'hasancse91:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
kazimdsaidul authored Sep 11, 2022
2 parents 0091058 + 0a8deec commit aedf405
Show file tree
Hide file tree
Showing 18 changed files with 182 additions and 275 deletions.
10 changes: 0 additions & 10 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,9 @@ android {
dev {
dimension "default"
applicationIdSuffix ".dev"
resValue "string", "google_api_key", localProperties["DEV_FIREBASE_ANDROID_API_KEY"]
resValue "string", "google_app_id", localProperties["DEV_FIREBASE_ANDROID_APP_ID"]
resValue "string", "gcm_defaultSenderId", localProperties["DEV_FIREBASE_ANDROID_MESSAGING_SENDER_ID"]
resValue "string", "google_storage_bucket", localProperties["DEV_FIREBASE_ANDROID_STORAGE_BUCKET"]
resValue "string", "project_id", localProperties["DEV_FIREBASE_ANDROID_PROJECT_ID"]
}
prod {
dimension "default"
resValue "string", "google_api_key", localProperties["PROD_FIREBASE_ANDROID_API_KEY"]
resValue "string", "google_app_id", localProperties["PROD_FIREBASE_ANDROID_APP_ID"]
resValue "string", "gcm_defaultSenderId", localProperties["PROD_FIREBASE_ANDROID_MESSAGING_SENDER_ID"]
resValue "string", "google_storage_bucket", localProperties["PROD_FIREBASE_ANDROID_STORAGE_BUCKET"]
resValue "string", "project_id", localProperties["PROD_FIREBASE_ANDROID_PROJECT_ID"]
}
}
}
Expand Down
40 changes: 40 additions & 0 deletions images/arrow_forward.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions images/ic_font_size.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions images/ic_language.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/ic_theme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions lib/app/core/base/base_view.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:get/get.dart';
import 'package:logger/logger.dart';

Expand Down Expand Up @@ -82,6 +83,14 @@ abstract class BaseView<Controller extends BaseController>
return Container();
}

void showToast(String message) {
Fluttertoast.showToast(
msg: message,
toastLength: Toast.LENGTH_SHORT,
timeInSecForIosWeb: 1
);
}

Color pageBackgroundColor() {
return AppColors.pageBackground;
}
Expand Down
1 change: 1 addition & 0 deletions lib/app/core/values/app_colors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ abstract class AppColors {
static const Color switchActiveColor = colorPrimary;
static const Color switchInactiveColor = Color(0xFFABABAB);
static Color elevatedContainerColorOpacity = Colors.grey.withOpacity(0.5);
static const Color suffixImageColor = Colors.grey;
}
5 changes: 5 additions & 0 deletions lib/app/core/values/text_styles.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ const titleStyle = TextStyle(
height: 1.34,
);

const settingsItemStyle = TextStyle(
fontSize: 16,
fontWeight: FontWeight.w400,
);

final cardTagStyle = titleStyle.copyWith(color: AppColors.textColorGreyDark);

const titleStyleWhite = TextStyle(
Expand Down
52 changes: 44 additions & 8 deletions lib/app/modules/settings/views/settings_view.dart
Original file line number Diff line number Diff line change
@@ -1,25 +1,61 @@
import 'package:flutter/material.dart';

import '/app/modules/settings/widgets/item_settings_widgets.dart';
import '/app/core/base/base_view.dart';
import '/app/core/values/text_styles.dart';
import '/app/core/widget/custom_app_bar.dart';
import '/app/modules/settings/controllers/settings_controller.dart';

class SettingsView extends BaseView<SettingsController> {
@override
PreferredSizeWidget? appBar(BuildContext context) {
return CustomAppBar(
appBarTitleText: 'Settings',
appBarTitleText: appLocalization.bottomNavSettings,
isBackButtonEnabled: false,
);
}

@override
Widget body(BuildContext context) {
return const Center(
child: Text(
'SettingsView is working',
style: titleStyle,
),
return Column(
children: [
ItemSettings(
title: appLocalization.settingsTheme,
prefixImage: 'ic_theme.png',
suffixImage: 'arrow_forward.svg',
onTap: _onThemeItemClicked,
),
_getHorizontalDivider(),
ItemSettings(
title: appLocalization.settingsLanguage,
prefixImage: 'ic_language.svg',
suffixImage: 'arrow_forward.svg',
onTap: _onLanguageItemClicked,
),
_getHorizontalDivider(),
ItemSettings(
title: appLocalization.settingsFontSize,
prefixImage: 'ic_font_size.svg',
suffixImage: 'arrow_forward.svg',
onTap: _onFontSizeItemClicked,
),
_getHorizontalDivider(),
],
);
}

Widget _getHorizontalDivider() {
return const Divider(height: 1);
}

void _onThemeItemClicked() {
showToast('Theme: Development in progress');
}

void _onLanguageItemClicked() {
showToast('Language: Development in progress');
}

void _onFontSizeItemClicked() {
showToast('Font Size: Development in progress');
}

}
49 changes: 49 additions & 0 deletions lib/app/modules/settings/widgets/item_settings_widgets.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import 'package:flutter/material.dart';
import '/app/core/base/base_widget_mixin.dart';
import '/app/core/values/app_colors.dart';
import '/app/core/values/app_values.dart';
import '/app/core/values/text_styles.dart';
import '/app/core/widget/asset_image_view.dart';
import '/app/core/widget/ripple.dart';

class ItemSettings extends StatelessWidget with BaseWidgetMixin {
final String prefixImage;
final String suffixImage;
final String title;
final Function()? onTap;

ItemSettings({
required this.prefixImage,
required this.suffixImage,
required this.title,
required this.onTap,
});

@override
Widget body(BuildContext context) {
return Ripple(
onTap: onTap,
child: Padding(
padding: const EdgeInsets.all(AppValues.padding),
child: Row(
children: [
AssetImageView(
fileName: prefixImage,
height: AppValues.iconSize_20,
width: AppValues.iconSize_20,
),
const SizedBox(width: AppValues.smallPadding),
Text(title, style: settingsItemStyle),
const Spacer(),
AssetImageView(
fileName: suffixImage,
color: AppColors.suffixImageColor,
height: AppValues.iconSize_20,
width: AppValues.iconSize_20,
),
],
),
),
);
}
}
80 changes: 0 additions & 80 deletions lib/firebase_options.dart

This file was deleted.

5 changes: 4 additions & 1 deletion lib/l10n/app_bn.arb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"bottomNavHome": "হোম",
"bottomNavFavorite": "ফেভারিট",
"bottomNavSettings": "সেটিংস",
"titleOtherView": "অন্যান্য"
"titleOtherView": "অন্যান্য",
"settingsTheme": "থিম",
"settingsLanguage": "ভাষা",
"settingsFontSize": "অক্ষরের আকার"
}
5 changes: 4 additions & 1 deletion lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"bottomNavHome": "Home",
"bottomNavFavorite": "Favorite",
"bottomNavSettings": "Settings",
"titleOtherView": "OtherView"
"titleOtherView": "OtherView",
"settingsTheme": "Theme",
"settingsLanguage": "Language",
"settingsFontSize": "Font Size"
}
18 changes: 2 additions & 16 deletions lib/main_dev.dart
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:logger/logger.dart';
import 'package:package_info_plus/package_info_plus.dart';

import '/app/my_app.dart';
import '/flavors/build_config.dart';
import '/flavors/env_config.dart';
import '/flavors/environment.dart';
import 'firebase_options.dart';

Future<void> main() async {
void main() {
EnvConfig devConfig = EnvConfig(
appName: "Flutter GetX Template Dev",
baseUrl: "https://api.github.com",
Expand All @@ -22,14 +16,6 @@ Future<void> main() async {
envType: Environment.DEVELOPMENT,
envConfig: devConfig,
);
WidgetsFlutterBinding.ensureInitialized();
PackageInfo packageInfo = await PackageInfo.fromPlatform();
Logger().d(packageInfo.packageName);
await dotenv.load(fileName: "conf/.env");
var app = await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform(Environment.DEVELOPMENT),
);
FirebaseAnalytics analytics = FirebaseAnalytics.instanceFor(app: app);
analytics.logEvent(name: "CUSTOM_EVENT", parameters: {"VAL": "VALUE1"});

runApp(const MyApp());
}
14 changes: 2 additions & 12 deletions lib/main_prod.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';

import '/app/my_app.dart';
import '/flavors/build_config.dart';
import '/flavors/env_config.dart';
import '/flavors/environment.dart';
import 'firebase_options.dart';

Future<void> main() async {
void main() {
EnvConfig prodConfig = EnvConfig(
appName: "Flutter GetX Template Prod",
baseUrl: "https://api.github.com",
Expand All @@ -20,12 +16,6 @@ Future<void> main() async {
envType: Environment.PRODUCTION,
envConfig: prodConfig,
);
WidgetsFlutterBinding.ensureInitialized();
await dotenv.load(fileName: "conf/.env");
var app = await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform(Environment.PRODUCTION),
);
FirebaseAnalytics analytics = FirebaseAnalytics.instanceFor(app: app);
analytics.logEvent(name: "CUSTOM_EVENT", parameters: {"VAL": "VALUE1"});

runApp(const MyApp());
}
Loading

0 comments on commit aedf405

Please sign in to comment.