Skip to content

Commit

Permalink
revert for release 1.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
theachoem committed Jan 5, 2022
1 parent 15dce92 commit 6c7daad
Show file tree
Hide file tree
Showing 11 changed files with 170 additions and 97 deletions.
2 changes: 1 addition & 1 deletion .fvm/flutter_sdk
2 changes: 1 addition & 1 deletion .fvm/fvm_config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"flutterSdkVersion": "2.5.3",
"flutterSdkVersion": "2.8.0",
"flavors": {}
}
19 changes: 10 additions & 9 deletions lib/notifier/remote_database_notifier.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,16 @@ class RemoteDatabaseNotifier with ChangeNotifier, DialogMixin, WSnackBarMixin {

load() async {
if (auth.user != null) {
// DbBackupModel? result = await GoogleDriveApi.fetchTxtData();
DbBackupModel? result = await service.backup(auth.user!.uid);
useCsv = false;
// if (result == null) {
// result = await service.backup(auth.user!.uid);
// useCsv = false;
// } else {
// useCsv = true;
// }
DbBackupModel? result = await GoogleDriveApi.fetchTxtData();

if (result == null) {
result = await service.backup(auth.user!.uid);
useCsv = false;
} else {
useCsv = true;
}

print(result?.db);

if (result != null && result.db != null) {
this._backup = result;
Expand Down
62 changes: 27 additions & 35 deletions lib/screens/story_detail/local_widgets/w_quil_toolbar.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_quill/models/documents/attribute.dart';
import 'package:flutter_quill/widgets/controller.dart';
import 'package:flutter_quill/flutter_quill.dart';
import 'package:flutter_quill/widgets/toolbar.dart' as toolbar;
import 'package:image_picker/image_picker.dart';
import 'package:storypad/widgets/w_tap_effect.dart';
import 'package:storypad/screens/story_detail/local_widgets/w_clear_format_btn.dart';
import 'package:storypad/screens/story_detail/local_widgets/w_color_button.dart';
Expand Down Expand Up @@ -147,19 +144,20 @@ class WQuillToolbar extends StatefulWidget implements PreferredSizeWidget {
IconData icon,
Color? fillColor,
bool? isToggled,
VoidCallback? _onPressed, [
double iconSize = 24.0,
VoidCallback? onPressed, [
double iconSize = WTOOLBARICONSIZE,
QuillIconTheme? iconTheme,
]) {
final _attributes = controller.getSelectionStyle().attributes;
final bool hasBlockList = _attributes.containsKey("blockquote");
final onPressed = hasBlockList ? null : _onPressed;
final _onPressed = hasBlockList ? null : onPressed;
return defaultToggleStyleButtonBuilder(
context,
attribute,
icon,
fillColor,
isToggled,
onPressed,
_onPressed,
iconSize,
);
},
Expand All @@ -177,19 +175,20 @@ class WQuillToolbar extends StatefulWidget implements PreferredSizeWidget {
IconData icon,
Color? fillColor,
bool? isToggled,
VoidCallback? _onPressed, [
double iconSize = 24.0,
VoidCallback? onPressed, [
double iconSize = WTOOLBARICONSIZE,
QuillIconTheme? iconTheme,
]) {
final _attributes = controller.getSelectionStyle().attributes;
final bool hasBlockList = _attributes.containsKey("blockquote");
final onPressed = hasBlockList ? null : _onPressed;
final _onPressed = hasBlockList ? null : onPressed;
return defaultToggleStyleButtonBuilder(
context,
attribute,
icon,
fillColor,
isToggled,
onPressed,
_onPressed,
iconSize,
);
},
Expand All @@ -207,19 +206,20 @@ class WQuillToolbar extends StatefulWidget implements PreferredSizeWidget {
IconData icon,
Color? fillColor,
bool? isToggled,
VoidCallback? _onPressed, [
double iconSize = 24.0,
VoidCallback? onPressed, [
double iconSize = WTOOLBARICONSIZE,
QuillIconTheme? iconTheme,
]) {
final _attributes = controller.getSelectionStyle().attributes;
final bool hasBlockList = _attributes.containsKey("blockquote");
final onPressed = hasBlockList ? null : _onPressed;
final _onPressed = hasBlockList ? null : onPressed;
return defaultToggleStyleButtonBuilder(
context,
attribute,
icon,
fillColor,
isToggled,
onPressed,
_onPressed,
iconSize,
);
},
Expand All @@ -242,20 +242,21 @@ class WQuillToolbar extends StatefulWidget implements PreferredSizeWidget {
IconData icon,
Color? fillColor,
bool? isToggled,
VoidCallback? _onPressed, [
double iconSize = 24.0,
VoidCallback? onPressed, [
double iconSize = WTOOLBARICONSIZE,
QuillIconTheme? iconTheme,
]) {
final _attributes = controller.getSelectionStyle().attributes;
final bool hasBlockQuote = _attributes.containsKey("blockquote");
final bool hasBlockList = _attributes.containsKey("list");
final onPressed = hasBlockQuote || hasBlockList ? null : _onPressed;
final _onPressed = hasBlockQuote || hasBlockList ? null : onPressed;
return defaultToggleStyleButtonBuilder(
context,
attribute,
icon,
fillColor,
isToggled,
onPressed,
_onPressed,
iconSize,
);
},
Expand All @@ -273,19 +274,20 @@ class WQuillToolbar extends StatefulWidget implements PreferredSizeWidget {
IconData icon,
Color? fillColor,
bool? isToggled,
VoidCallback? _onPressed, [
double iconSize = 24.0,
VoidCallback? onPressed, [
double iconSize = WTOOLBARICONSIZE,
QuillIconTheme? iconTheme,
]) {
final _attributes = controller.getSelectionStyle().attributes;
final bool hasBlockList = _attributes.containsKey("list");
final onPressed = hasBlockList ? null : _onPressed;
final _onPressed = hasBlockList ? null : onPressed;
return defaultToggleStyleButtonBuilder(
context,
attribute,
icon,
fillColor,
isToggled,
onPressed,
_onPressed,
iconSize,
);
},
Expand Down Expand Up @@ -353,22 +355,11 @@ class WQuillToolbar extends StatefulWidget implements PreferredSizeWidget {
child: toolbar.ImageButton(
icon: Icons.image,
controller: controller,
imageSource: ImageSource.gallery,
onImagePickCallback: onImagePickCallback,
iconSize: WTOOLBARICONSIZE,
),
),
spaceBetween,
Visibility(
visible: onImagePickCallback != null,
child: toolbar.ImageButton(
icon: Icons.photo_camera,
controller: controller,
imageSource: ImageSource.camera,
onImagePickCallback: onImagePickCallback,
iconSize: WTOOLBARICONSIZE,
),
),
spaceBetween2,
],
);
Expand All @@ -382,6 +373,7 @@ class WQuillToolbar extends StatefulWidget implements PreferredSizeWidget {
bool? isToggled,
VoidCallback? onPressed, [
double iconSize = WTOOLBARICONSIZE,
QuillIconTheme? iconTheme,
]) {
final theme = Theme.of(context);
final isEnabled = onPressed != null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class _WSelectHeaderStyleButtonState extends State<WSelectHeaderStyleButton> {
mainAxisSize: MainAxisSize.min,
children: List.generate(3, (index) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: !kIsWeb ? 1.0 : 5.0),
padding: EdgeInsets.symmetric(horizontal: !kIsWeb ? 1.0 : 5.0),
child: ConstrainedBox(
constraints: BoxConstraints.tightFor(
width: iconSize * 1.77,
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/story_detail/story_detail_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class StoryDetailScreen extends HookWidget with StoryDetailMethodMixin, HookCont
keyboardAppearance: _theme.colorScheme.brightness,
enableInteractiveSelection: true,
expands: false,
embedBuilder: (BuildContext context, leaf.Embed node) {
embedBuilder: (BuildContext context, leaf.Embed node, bool readOnly) {
return _embedBuilder(
context: context,
node: node,
Expand Down
10 changes: 7 additions & 3 deletions lib/services/local_storages/databases/base_database.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ abstract class BaseDatabase {
List<Map<dynamic, dynamic>>? result = await database?.query(table());
if (result == null) return null;
if (result.isEmpty) return null;
return itemsTransformer(result);
var rt = itemsTransformer(result);
return rt;
});
}

Expand Down Expand Up @@ -74,8 +75,11 @@ abstract class BaseDatabase {
List<BaseModel?> items = list.map((json) {
return objectTransformer(json);
}).toList();
items.removeWhere((element) => element == null);
return items as List<BaseModel>?;
List<BaseModel> result = [];
items.forEach((e) {
if (e is BaseModel) result.add(e);
});
return result;
}

BaseModel? objectTransformer(Map<dynamic, dynamic>? json);
Expand Down
2 changes: 2 additions & 0 deletions lib/services/local_storages/databases/story_database.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ class StoryDatabase extends BaseDatabase {

Future<Map<int, StoryModel>> storyById({String? where}) async {
final list = await super.fetchAll();

Map<int, StoryModel> map = {};
list?.forEach((e) {
if (e is StoryModel) {
String? _paragraph = e.paragraph != null ? HtmlCharacterEntities.decode(e.paragraph!) : null;
map[e.id] = e.copyWith(paragraph: _paragraph?.replaceAll(this.singleQuote, "'"));
}
});

return map;
}

Expand Down
2 changes: 2 additions & 0 deletions lib/services/local_storages/databases/w_database.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ class WDatabase {
/// add new feeling column if not existed
try {
await database.rawQuery("SELECT feeling from story;");
await database.rawQuery("SELECT is_share from story");
} catch (e) {
await database.execute("ALTER TABLE story ADD COLUMN feeling char(50);");
await database.execute("ALTER TABLE story ADD COLUMN is_share INTEGER");
}
}
}

0 comments on commit 6c7daad

Please sign in to comment.