Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing String and Imports #6

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions ios/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def parse_KV_file(file, separator='=')
file_abs_path = File.expand_path(file)
if !File.exists? file_abs_path
return [];
end
pods_ary = []
skip_line_start_symbols = ["#", "/"]
File.foreach(file_abs_path) { |line|
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
plugin = line.split(pattern=separator)
if plugin.length == 2
podname = plugin[0].strip()
path = plugin[1].strip()
podpath = File.expand_path("#{path}", file_abs_path)
pods_ary.push({:name => podname, :path => podpath});
else
puts "Invalid plugin specification: #{line}"
end
}
return pods_ary
end

target 'Runner' do
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')

# Flutter Pods
generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
if generated_xcode_build_settings.empty?
puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
end
generated_xcode_build_settings.map { |p|
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
symlink = File.join('.symlinks', 'flutter')
File.symlink(File.dirname(p[:path]), symlink)
pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
end
}

# Plugin Pods
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods.map { |p|
symlink = File.join('.symlinks', 'plugins', p[:name])
File.symlink(p[:path], symlink)
pod p[:name], :path => File.join(symlink, 'ios')
}
end

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
3 changes: 3 additions & 0 deletions lib/constants/index.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export 'app_theme.dart';
export 'dimens.dart';
export 'strings.dart';
15 changes: 10 additions & 5 deletions lib/constants/strings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ class Strings {
Strings._();

//General
static const String appName = "Boilerplate Project";
static const String appName = 'Boilerplate Project';

//Login
static const String login_et_user_email = "Enter user email";
static const String login_et_user_password = "Enter password";
static const String login_btn_forgot_password = "Forgot Password?";
static const String login_btn_sign_in = "Sign In";
static const String login_et_user_email = 'Enter user email';
static const String login_et_user_password = 'Enter password';
static const String login_btn_forgot_password = 'Forgot Password?';
static const String login_btn_sign_in = 'Sign In';
static const String login_validation_error = 'Please fill in all fields';

//Posts
static const String posts_title = 'Posts';
static const String posts_not_found = 'No Posts Found';
}
1 change: 1 addition & 0 deletions lib/data/index.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'repository.dart';
1 change: 1 addition & 0 deletions lib/data/local/constants/index.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'db_constants.dart';
1 change: 1 addition & 0 deletions lib/data/local/datasources/post/index.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'post_datasource.dart';
1 change: 1 addition & 0 deletions lib/data/local/index.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'app_database.dart';
1 change: 1 addition & 0 deletions lib/data/network/apis/posts/index.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'post_api.dart';
1 change: 1 addition & 0 deletions lib/data/network/constants/index.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'endpoints.dart';
1 change: 1 addition & 0 deletions lib/data/network/exceptions/index.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'network_exceptions.dart';
2 changes: 2 additions & 0 deletions lib/data/network/index.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export 'dio_client.dart';
export 'rest_client.dart';
1 change: 1 addition & 0 deletions lib/data/sharedpref/constants/index.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'preferences.dart';
2 changes: 2 additions & 0 deletions lib/models/post/index.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export 'post.dart';
export 'post_list.dart';
14 changes: 8 additions & 6 deletions lib/ui/home/home.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import 'package:boilerplate/data/sharedpref/constants/preferences.dart';
import 'package:boilerplate/routes.dart';
import 'package:boilerplate/stores/post/post_store.dart';
import 'package:boilerplate/widgets/progress_indicator_widget.dart';
import 'package:boilerplate/constants/index.dart';
import 'package:flushbar/flushbar_helper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:shared_preferences/shared_preferences.dart';

import '../../data/sharedpref/constants/preferences.dart';
import '../../routes.dart';
import '../../stores/post/post_store.dart';
import '../../widgets/progress_indicator_widget.dart';

class HomeScreen extends StatefulWidget {
@override
_HomeScreenState createState() => _HomeScreenState();
Expand Down Expand Up @@ -34,7 +36,7 @@ class _HomeScreenState extends State<HomeScreen> {

Widget _buildAppBar(BuildContext context) {
return AppBar(
title: Text('Posts'),
title: Text(Strings.posts_title),
actions: <Widget>[
IconButton(
onPressed: () {
Expand Down Expand Up @@ -99,7 +101,7 @@ class _HomeScreenState extends State<HomeScreen> {
);
},
)
: Center(child: Text('No posts found'));
: Center(child: Text(Strings.posts_not_found));
}

// General Methods:-----------------------------------------------------------
Expand Down
25 changes: 13 additions & 12 deletions lib/ui/login/login.dart
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import 'package:boilerplate/constants/strings.dart';
import 'package:boilerplate/data/sharedpref/constants/preferences.dart';
import 'package:boilerplate/routes.dart';
import 'package:boilerplate/stores/form/form_store.dart';
import 'package:boilerplate/widgets/app_icon_widget.dart';
import 'package:boilerplate/widgets/empty_app_bar_widget.dart';
import 'package:boilerplate/widgets/progress_indicator_widget.dart';
import 'package:boilerplate/widgets/rounded_button_widget.dart';
import 'package:boilerplate/widgets/textfield_widget.dart';
import 'package:flushbar/flushbar_helper.dart';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:flushbar/flushbar_helper.dart';
import 'package:shared_preferences/shared_preferences.dart';

import '../../constants/strings.dart';
import '../../data/sharedpref/constants/preferences.dart';
import '../../routes.dart';
import '../../stores/form/form_store.dart';
import '../../widgets/app_icon_widget.dart';
import '../../widgets/empty_app_bar_widget.dart';
import '../../widgets/progress_indicator_widget.dart';
import '../../widgets/rounded_button_widget.dart';
import '../../widgets/textfield_widget.dart';

class LoginScreen extends StatefulWidget {
@override
Expand Down Expand Up @@ -211,7 +212,7 @@ class _LoginScreenState extends State<LoginScreen> {
if (_store.canLogin) {
_store.login();
} else {
showErrorMessage(context, 'Please fill in all fields');
showErrorMessage(context, Strings.login_validation_error);
}
},
);
Expand Down
13 changes: 8 additions & 5 deletions lib/ui/splash/splash.dart
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import 'dart:async';

import 'package:boilerplate/data/sharedpref/constants/preferences.dart';
import 'package:boilerplate/routes.dart';
import 'package:boilerplate/widgets/app_icon_widget.dart';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';

import '../../data/sharedpref/constants/preferences.dart';
import '../../routes.dart';
import '../../widgets/app_icon_widget.dart';

class SplashScreen extends StatefulWidget {
@override
State<StatefulWidget> createState() => _SplashScreenState();
}

const bool autoLogin = true;

class _SplashScreenState extends State<SplashScreen> {
@override
void initState() {
Expand All @@ -33,8 +36,8 @@ class _SplashScreenState extends State<SplashScreen> {
navigate() async {
SharedPreferences preferences = await SharedPreferences.getInstance();

if (preferences.getBool(Preferences.is_logged_in) ?? false) {
Navigator.of(context).pushReplacementNamed(Routes.login);
if (autoLogin && preferences.getBool(Preferences.is_logged_in) ?? false) {
Navigator.of(context).pushReplacementNamed(Routes.home);
} else {
Navigator.of(context).pushReplacementNamed(Routes.login);
}
Expand Down
1 change: 1 addition & 0 deletions lib/utils/dio/index.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'dio_error_util.dart';
1 change: 1 addition & 0 deletions lib/utils/encryption/index.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'xxtea.dart';
5 changes: 5 additions & 0 deletions lib/widgets/index.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export 'app_icon_widget.dart';
export 'empty_app_bar_widget.dart';
export 'progress_indicator_widget.dart';
export 'rounded_button_widget.dart';
export 'textfield_widget.dart';
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ environment:
dependencies:
flutter:
sdk: flutter

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2

# The following adds the shared pref as a dependency in your application
shared_preferences: ^0.4.3

# localstorage: ^2.0.0

# A composable, Future-based library for making HTTP requests.
http: ^0.12.0+1

Expand Down Expand Up @@ -65,7 +66,6 @@ dev_dependencies:
flutter_test:
sdk: flutter

flutter_launcher_icons: "^0.7.0"
build_runner: ^1.3.0

flutter_icons:
Expand Down