Skip to content

Commit

Permalink
Merge pull request #2 from geekymon2/version-upgrade
Browse files Browse the repository at this point in the history
Version upgrade
  • Loading branch information
geekymon2 authored May 27, 2024
2 parents f22d056 + 1ca8134 commit cd47d00
Show file tree
Hide file tree
Showing 39 changed files with 430 additions and 476 deletions.
4 changes: 4 additions & 0 deletions DEVINFO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# DEVELOPER NOTES

- flutter pub cache clean: Cleans the dependency cache
- flutter pub get: downloads the dependencies
19 changes: 11 additions & 8 deletions Nitnem.code-workspace
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
"folders": [
{
"path": "../nitnem"
}
],
"settings": {
"java.configuration.updateBuildConfiguration": "automatic"
}
"folders": [
{
"path": "../nitnem"
}
],
"settings": {
"java.configuration.updateBuildConfiguration": "automatic",
"yaml.schemas": {
"https://json.schemastore.org/pubspec.json": "file:///c%3A/Users/manpr/Projects/GitHub/nitnem/pubspec.yaml"
}
}
}
46 changes: 27 additions & 19 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
Expand All @@ -6,11 +18,6 @@ if (localPropertiesFile.exists()) {
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
Expand All @@ -21,26 +28,27 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
compileSdkVersion 28
namespace "com.geekymon2.nitnem"
compileSdkVersion 34

lintOptions {
disable 'InvalidPackage'
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget=17
}

defaultConfig {
applicationId "com.manpreet.nitnem"
minSdkVersion 16
targetSdkVersion 29
applicationId "com.geekymon2.nitnem"
minSdkVersion flutter.minSdkVersion
targetSdkVersion 34
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
Expand Down Expand Up @@ -78,4 +86,4 @@ dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
}
}
28 changes: 24 additions & 4 deletions android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.manpreet.nitnem">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
package="com.geekymon2.nitnem">
<application
android:label="Nitnem"
android:icon="@mipmap/launcher_icon">
<activity
android:name="io.flutter.embedding.android.FlutterActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<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"/>
</intent-filter>
</activity>
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
3 changes: 2 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.manpreet.nitnem">
package="com.geekymon2.nitnem">
<application
android:label="Nitnem"
android:icon="@mipmap/launcher_icon">
<activity
android:name="io.flutter.embedding.android.FlutterActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ import io.flutter.plugins.GeneratedPluginRegistrant
class MainActivity: FlutterActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
GeneratedPluginRegistrant.registerWith(this)
}
}
25 changes: 13 additions & 12 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
buildscript {
repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
}
}

allprojects {
repositories {
google()
Expand All @@ -17,13 +6,25 @@ allprojects {
}

rootProject.buildDir = '../build'
subprojects {
afterEvaluate { project ->
if (project.hasProperty('android')) {
project.android {
if (namespace == null) {
namespace "com.geekymon2.nitnem"
}
}
}
}
}
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {

tasks.register("clean", Delete) {
delete rootProject.buildDir
}
6 changes: 3 additions & 3 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Nov 25 16:30:13 AEDT 2020
#Fri May 24 15:46:31 AEST 2024
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
30 changes: 20 additions & 10 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
include ':app'
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()

def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

def plugins = new Properties()
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
if (pluginsFile.exists()) {
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

plugins.each { name, path ->
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
include ":$name"
project(":$name").projectDir = pluginDirectory
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.1.1" apply false
id "org.jetbrains.kotlin.android" version "1.9.20" apply false
}

include ":app"
3 changes: 3 additions & 0 deletions devtools_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
description: This file stores settings for Dart & Flutter DevTools.
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
extensions:
67 changes: 34 additions & 33 deletions lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,29 @@ class NitnemApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return StoreProvider<AppState>(
store: store,
child: new StoreConnector<AppState, _ViewModel>(
converter: _ViewModel.fromStore,
onInit: (store) => store.dispatch(FetchOptionsAction()),
builder: (context, vm) => MaterialApp (
title: 'Nitnem App',
debugShowCheckedModeBanner: false,
theme: getThemeByName(vm.themeName).data,
color: Colors.grey,
home: SplashScreen(),
routes: _buildRoutes(),
builder: (BuildContext context, Widget child) {
return Directionality(
child: CupertinoTheme (
// Specifically use a blank Cupertino theme here and do not transfer
// over the Material primary color etc except the brightness to
// showcase standard iOS looks.
data: CupertinoThemeData (
brightness: getThemeByName(vm.themeName).data.brightness,
),
child: child
),
textDirection: TextDirection.ltr,
);
},
),
)
);
store: store,
child: new StoreConnector<AppState, _ViewModel>(
converter: _ViewModel.fromStore,
onInit: (store) => store.dispatch(FetchOptionsAction()),
builder: (context, vm) => MaterialApp(
title: 'Nitnem App',
debugShowCheckedModeBanner: false,
theme: getThemeByName(vm.themeName).data,
color: Colors.grey,
home: SplashScreen(),
routes: _buildRoutes(),
builder: (BuildContext context, Widget? child) {
return Directionality(
child: CupertinoTheme(
data: CupertinoThemeData(
brightness: getThemeByName(vm.themeName).data.brightness,
),
child: child!),
textDirection: TextDirection.ltr,
);
},
),
));
}

Map<String, WidgetBuilder> _buildRoutes() {
Expand All @@ -55,15 +50,19 @@ class NitnemApp extends StatelessWidget {
key: (dynamic route) => '${route.routeName}',
value: (dynamic route) => route.buildRoute,
);
}
}

List<AppRoute> _getRoutes() {
final List<AppRoute> routes = <AppRoute>[
// Demos
AppRoute(
routeName: '/home',
buildRoute: (BuildContext context) => HomeScreen(
optionsPage: OptionsPage(readerMode: false),
optionsPage: OptionsPage(
readerMode: false,
key: UniqueKey(),
),
key: UniqueKey(),
),
),
AppRoute(
Expand All @@ -72,7 +71,9 @@ class NitnemApp extends StatelessWidget {
),
AppRoute(
routeName: '/reader',
buildRoute: (BuildContext context) => ReaderScreen(),
buildRoute: (BuildContext context) => ReaderScreen(
key: UniqueKey(),
),
),
];
return routes;
Expand All @@ -81,7 +82,7 @@ class NitnemApp extends StatelessWidget {

class _ViewModel {
final String themeName;
_ViewModel({@required this.themeName});
_ViewModel({required this.themeName});

static _ViewModel fromStore(Store<AppState> store) {
return _ViewModel(
Expand All @@ -103,4 +104,4 @@ class _ViewModel {
String toString() {
return '_ViewModel{themeName: $themeName}';
}
}
}
5 changes: 2 additions & 3 deletions lib/data/theme_default.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,18 @@ ThemeData buildLightTheme() {
final ColorScheme colorScheme = const ColorScheme.light().copyWith(
primary: primaryColor,
secondary: secondaryColor,
surface: Colors.blue,
error: const Color(0xFFB00020),
);
final ThemeData base = ThemeData(
brightness: Brightness.light,
colorScheme: colorScheme,
primaryColor: primaryColor,
indicatorColor: Colors.white,
toggleableActiveColor: const Color(0xFF39CEFD),
splashColor: Colors.white24,
splashFactory: InkRipple.splashFactory,
canvasColor: Colors.white,
scaffoldBackgroundColor: Colors.white,
backgroundColor: Colors.white,
errorColor: const Color(0xFFB00020),
highlightColor: Colors.blueGrey,
buttonTheme: ButtonThemeData(
colorScheme: colorScheme,
Expand Down
Loading

0 comments on commit cd47d00

Please sign in to comment.