Skip to content

Commit

Permalink
Merge pull request #55 from xsoulspace/3.17
Browse files Browse the repository at this point in the history
3.17
  • Loading branch information
Arenukvern authored Dec 1, 2023
2 parents 6ff53f1 + 4285109 commit 3b6efc8
Show file tree
Hide file tree
Showing 19 changed files with 199 additions and 136 deletions.
16 changes: 7 additions & 9 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
Expand All @@ -6,11 +12,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,10 +22,6 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

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

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
Expand All @@ -33,6 +30,7 @@ if (keystorePropertiesFile.exists()) {


android {
namespace "dev.xsoulspace.lastanswer"
compileSdkVersion 34
ndkVersion flutter.ndkVersion

Expand Down
3 changes: 1 addition & 2 deletions android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.xsoulspace.lastanswer">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
Expand Down
8 changes: 4 additions & 4 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.xsoulspace.lastanswer">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:label="Last Answer"
android:icon="@mipmap/ic_launcher">
android:label="Last Answer"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
Expand Down
3 changes: 1 addition & 2 deletions android/app/src/profile/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.xsoulspace.lastanswer">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
Expand Down
1 change: 0 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down
3 changes: 3 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
4 changes: 2 additions & 2 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
34 changes: 26 additions & 8 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
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
}
settings.ext.flutterSdkPath = flutterSdkPath()

def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")

assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
repositories {
google()
mavenCentral()
gradlePluginPortal()
}

def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
plugins {
id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false
}
}

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
}

include ":app"
52 changes: 31 additions & 21 deletions lib/home/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,27 +104,37 @@ class _ProjectsListView extends StatelessWidget {
);
final Widget child = Column(
children: [
Flexible(
child: PagedListView<int, ProjectModel>(
pagingController: projectsController.pager,
reverse: isReversed,
builderDelegate: PagedChildBuilderDelegate(
itemBuilder: (final context, final item, final index) =>
ProjectTile(
onRemove: (final _) async {
final shouldProceed = await showRemoveTitleDialog(
context: context,
title: item.title,
);
if (shouldProceed) {
projectsNotifier.deleteProject(item);
}
},
project: item,
onTap: (final item) {
projectNotifier.loadProject(project: item, context: context);
},
selected: openedProjectId == item.id,
Expanded(
child: RefreshIndicator(
onRefresh: () async {
projectsController
..refresh()
..loadFirstPage();
},
child: PagedListView<int, ProjectModel>(
pagingController: projectsController.pager,
reverse: isReversed,
builderDelegate: PagedChildBuilderDelegate(
itemBuilder: (final context, final item, final index) =>
ProjectTile(
onRemove: (final _) async {
final shouldProceed = await showRemoveTitleDialog(
context: context,
title: item.title,
);
if (shouldProceed) {
projectsNotifier.deleteProject(item);
}
},
project: item,
onTap: (final item) {
projectNotifier.loadProject(
project: item,
context: context,
);
},
selected: openedProjectId == item.id,
),
),
),
),
Expand Down
12 changes: 8 additions & 4 deletions lib/home/widgets/project_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,14 @@ class ProjectTile extends StatelessWidget {
title: Stack(
children: [
effectiveLeadingIcon,
Text(
' ${createTitle()}',
overflow: TextOverflow.ellipsis,
maxLines: 4,
HeroId(
id: project.id.value,
type: HeroIdTypes.projectTitle,
child: Text(
' ${createTitle()}',
overflow: TextOverflow.ellipsis,
maxLines: 4,
),
),
],
),
Expand Down
1 change: 0 additions & 1 deletion lib/idea/create_idea_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ class _CreateIdeaProjectScreenState extends State<CreateIdeaProjectScreen> {
onFieldSubmitted: (final _) => onCreate(),
controller: _textController,
maxLength: 90,
maxLines: null,
style: context.textTheme.displaySmall?.copyWith(
color: textColor,
),
Expand Down
82 changes: 41 additions & 41 deletions lib/idea/widgets/answer_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,48 +47,48 @@ class AnswerTile extends StatelessWidget {
child: SizedBox(
width: 150,
child: HeroId(
flightShuttleBuilder: (
final context,
final animation,
final direction,
final ____,
final _____,
) {
switch (direction) {
case HeroFlightDirection.pop:
return Material(
child: Padding(
padding: const EdgeInsets.only(left: 8, top: 11.5),
child: Text(
answer.question.title.localize(context),
textAlign: TextAlign.left,
style: Theme.of(context).textTheme.bodyLarge,
),
),
);
case HeroFlightDirection.push:
return Material(
child: Padding(
padding: EdgeInsets.zero,
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
answer.question.title.localize(context),
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodyLarge,
),
// flightShuttleBuilder: (
// final context,
// final animation,
// final direction,
// final ____,
// final _____,
// ) {
// switch (direction) {
// case HeroFlightDirection.pop:
// return Material(
// child: Padding(
// padding: const EdgeInsets.only(left: 8, top: 11.5),
// child: Text(
// answer.question.title.localize(context),
// textAlign: TextAlign.left,
// style: Theme.of(context).textTheme.bodyLarge,
// ),
// ),
// );
// case HeroFlightDirection.push:
// return Material(
// child: Padding(
// padding: EdgeInsets.zero,
// child: Row(
// mainAxisSize: MainAxisSize.min,
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Text(
// answer.question.title.localize(context),
// textAlign: TextAlign.center,
// style: Theme.of(context).textTheme.bodyLarge,
// ),

/// Size of icon for dropdown
const SizedBox(width: 24),
],
),
),
);
}
},
id: '${answer.id}-question${answer.question.id}',
// /// Size of icon for dropdown
// const SizedBox(width: 24),
// ],
// ),
// ),
// );
// }
// },
id: '${answer.id}-question',
type: HeroIdTypes.projectIdeaQuestionTitle,
child: QuestionDropdown(
answer: answer,
Expand Down
46 changes: 27 additions & 19 deletions lib/note/note_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,19 @@ class NoteView extends StatefulWidget {
class _NoteViewState extends State<NoteView>
with SingleTickerProviderStateMixin {
@override
Widget build(final BuildContext context) => ChangeNotifierProvider(
create: (final _) => NoteViewBloc(
dto: NoteViewBlocDto(
initialNote: widget.note,
tickerProvider: this,
context: context,
Widget build(final BuildContext context) => PopScope(
onPopInvoked: (final _) =>
context.read<OpenedProjectNotifier>().onPopProject(),
child: ChangeNotifierProvider(
create: (final _) => NoteViewBloc(
dto: NoteViewBlocDto(
initialNote: widget.note,
tickerProvider: this,
context: context,
),
),
builder: (final context, final child) => const NoteViewBody(),
),
builder: (final context, final child) => const NoteViewBody(),
);
}

Expand All @@ -46,18 +50,22 @@ class NoteViewBody extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.end,
children: [
Expanded(
child: ProjectTextField(
hintText: context.l10n.writeANote,
filled: false,
hasBorder: false,
contentPadding: const EdgeInsets.only(left: 24),
limit: int.tryParse(bloc.characterLimitController.value),
focusNode: bloc.focusNode,
endlessLines: true,
focusOnInit: bloc.dto.initialNote.note.isEmpty,
onSubmit: bloc.onSubmit,
controller: bloc.noteController,
undoController: bloc.undoController,
child: HeroId(
id: bloc.note.id.value,
type: HeroIdTypes.projectTitle,
child: ProjectTextField(
hintText: context.l10n.writeANote,
filled: false,
hasBorder: false,
contentPadding: const EdgeInsets.only(left: 24),
limit: int.tryParse(bloc.characterLimitController.value),
focusNode: bloc.focusNode,
endlessLines: true,
focusOnInit: bloc.dto.initialNote.note.isEmpty,
onSubmit: bloc.onSubmit,
controller: bloc.noteController,
undoController: bloc.undoController,
),
),
),
if (PlatformInfo.isNativeWebDesktop) const Gap(48),
Expand Down
4 changes: 4 additions & 0 deletions packages/core/lib/src/data_sources/local_hive/hive_db.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ final class ComplexLocalDbHiveImpl implements ComplexLocalDb {
@override
Future<void> close() async {
await Hive.close();
_isOpen = false;
}

static bool _isOpen = false;
@override
Future<void> open() async {
if (_isOpen) return;
await Hive.initFlutter();
Hive
..registerAdapter(IdeaProjectAdapter())
Expand All @@ -19,5 +22,6 @@ final class ComplexLocalDbHiveImpl implements ComplexLocalDb {
..registerAdapter(IdeaProjectQuestionAdapter())
..registerAdapter(NoteProjectAdapter())
..registerAdapter(ProjectFolderAdapter());
_isOpen = true;
}
}
Loading

0 comments on commit 3b6efc8

Please sign in to comment.