Skip to content

Commit

Permalink
Merge pull request #17 from rish07/master
Browse files Browse the repository at this point in the history
Fixed bottom toolbar and added Web files
  • Loading branch information
singerdmx authored Feb 10, 2021
2 parents 5c31cd8 + 33302db commit b469475
Show file tree
Hide file tree
Showing 17 changed files with 201 additions and 52 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.example.app

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
}
12 changes: 12 additions & 0 deletions app/android/app/src/main/res/drawable-v21/launch_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="?android:colorBackground" />

<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>
18 changes: 18 additions & 0 deletions app/android/app/src/main/res/values-night/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
13 changes: 13 additions & 0 deletions app/ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import UIKit
import Flutter

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
1 change: 1 addition & 0 deletions app/ios/Runner/Runner-Bridging-Header.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#import "GeneratedPluginRegistrant.h"
5 changes: 3 additions & 2 deletions app/lib/pages/home_page.dart
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:tuple/tuple.dart';

import 'package:app/pages/read_only_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_quill/models/documents/document.dart';
import 'package:flutter_quill/widgets/controller.dart';
import 'package:flutter_quill/widgets/default_styles.dart';
import 'package:flutter_quill/widgets/editor.dart';
import 'package:flutter_quill/widgets/toolbar.dart';
import 'package:tuple/tuple.dart';

import 'read_only_page.dart';

class HomePage extends StatefulWidget {
@override
Expand Down
3 changes: 2 additions & 1 deletion app/lib/pages/read_only_page.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import 'package:app/widgets/demo_scaffold.dart';
import 'package:flutter/material.dart';
import 'package:flutter_quill/widgets/controller.dart';
import 'package:flutter_quill/widgets/editor.dart';

import '../widgets/demo_scaffold.dart';

class ReadOnlyPage extends StatefulWidget {
@override
_ReadOnlyPageState createState() => _ReadOnlyPageState();
Expand Down
49 changes: 28 additions & 21 deletions app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,42 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.0-nullsafety.1"
version: "2.5.0-nullsafety.3"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0-nullsafety.1"
version: "2.1.0-nullsafety.3"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.3"
version: "1.1.0-nullsafety.5"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0-nullsafety.1"
version: "1.2.0-nullsafety.3"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.1"
version: "1.1.0-nullsafety.3"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0-nullsafety.3"
version: "1.15.0-nullsafety.5"
cupertino_icons:
dependency: "direct main"
description:
Expand All @@ -56,7 +56,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0-nullsafety.1"
version: "1.2.0-nullsafety.3"
flutter:
dependency: "direct main"
description: flutter
Expand All @@ -82,7 +82,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.2.5"
version: "0.2.6"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down Expand Up @@ -121,27 +121,34 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3-nullsafety.3"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.10-nullsafety.1"
version: "0.12.10-nullsafety.3"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0-nullsafety.3"
version: "1.3.0-nullsafety.6"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0-nullsafety.1"
version: "1.8.0-nullsafety.3"
pedantic:
dependency: transitive
description:
Expand Down Expand Up @@ -195,42 +202,42 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0-nullsafety.2"
version: "1.8.0-nullsafety.4"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0-nullsafety.1"
version: "1.10.0-nullsafety.6"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0-nullsafety.1"
version: "2.1.0-nullsafety.3"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.1"
version: "1.1.0-nullsafety.3"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0-nullsafety.1"
version: "1.2.0-nullsafety.3"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.19-nullsafety.2"
version: "0.2.19-nullsafety.6"
tuple:
dependency: transitive
description:
Expand All @@ -244,7 +251,7 @@ packages:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0-nullsafety.3"
version: "1.3.0-nullsafety.5"
url_launcher:
dependency: transitive
description:
Expand Down Expand Up @@ -293,7 +300,7 @@ packages:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0-nullsafety.3"
version: "2.1.0-nullsafety.5"
sdks:
dart: ">=2.10.0-110 <2.11.0"
flutter: ">=1.22.0 <2.0.0"
dart: ">=2.12.0-0.0 <3.0.0"
flutter: ">=1.22.0"
Binary file added app/web/favicon.png
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 app/web/icons/Icon-192.png
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 app/web/icons/Icon-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions app/web/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!DOCTYPE html>
<html>
<head>
<!--
If you are serving your web app in a path other than the root, change the
href value below to reflect the base path you are serving from.
The path provided below has to start and end with a slash "/" in order for
it to work correctly.
Fore more details:
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
-->
<base href="/">

<meta charset="UTF-8">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
<meta name="description" content="A new Flutter project.">

<!-- iOS meta tags & icons -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="app">
<link rel="apple-touch-icon" href="icons/Icon-192.png">

<!-- Favicon -->
<link rel="icon" type="image/png" href="favicon.png"/>

<title>app</title>
<link rel="manifest" href="manifest.json">
</head>
<body>
<!-- This script installs service_worker.js to provide PWA functionality to
application. For more information, see:
https://developers.google.com/web/fundamentals/primers/service-workers -->
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('flutter-first-frame', function () {
navigator.serviceWorker.register('flutter_service_worker.js');
});
}
</script>
<script src="main.dart.js" type="application/javascript"></script>
</body>
</html>
23 changes: 23 additions & 0 deletions app/web/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "app",
"short_name": "app",
"start_url": ".",
"display": "standalone",
"background_color": "#0175C2",
"theme_color": "#0175C2",
"description": "A new Flutter project.",
"orientation": "portrait-primary",
"prefer_related_applications": false,
"icons": [
{
"src": "icons/Icon-192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "icons/Icon-512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}
2 changes: 1 addition & 1 deletion lib/widgets/text_line.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class TextLine extends StatelessWidget {
textAlign,
textDirection,
1.0,
Localizations.localeOf(context, nullOk: true),
Localizations.localeOf(context),
strutStyle,
TextWidthBasis.parent,
null);
Expand Down
1 change: 1 addition & 0 deletions lib/widgets/text_selection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ class EditorTextSelectionOverlay {
endpoints,
selectionDelegate,
clipboardStatus,
Offset(0, 0),
),
),
);
Expand Down
28 changes: 21 additions & 7 deletions lib/widgets/toolbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,10 @@ class _SelectHeaderStyleButtonState extends State<SelectHeaderStyleButton> {
@override
void initState() {
super.initState();
_value =
_selectionStyle.attributes[Attribute.header.key] ?? Attribute.header;
setState(() {
_value =
_selectionStyle.attributes[Attribute.header.key] ?? Attribute.header;
});
widget.controller.addListener(_didChangeEditingValue);
}

Expand Down Expand Up @@ -444,7 +446,13 @@ Widget _selectHeadingStyleButtonBuilder(
height: iconSize * 1.77,
fillColor: Theme.of(context).canvasColor,
child: Text(
_valueToText[value],
_valueToText[value.key == "header"
? Attribute.header
: (value.key == "h1")
? Attribute.h1
: (value.key == "h2")
? Attribute.h2
: Attribute.h3],
style: TextStyle(fontSize: 13, fontWeight: FontWeight.w600),
),
initialValue: value,
Expand Down Expand Up @@ -1082,11 +1090,17 @@ class _QuillToolbarState extends State<QuillToolbar> {
padding: EdgeInsets.symmetric(horizontal: 8),
constraints: BoxConstraints.tightFor(height: widget.preferredSize.height),
color: Theme.of(context).canvasColor,
child: SingleChildScrollView(
child: CustomScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: widget.children,
),
slivers: [
SliverFillRemaining(
hasScrollBody: false,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: widget.children,
),
),
],
),
);
}
Expand Down
Loading

0 comments on commit b469475

Please sign in to comment.