Compare commits

...

10 Commits

100 changed files with 2454 additions and 1195 deletions

View File

@ -1,4 +1,4 @@
include: package:very_good_analysis/analysis_options.3.1.0.yaml
include: package:very_good_analysis/analysis_options.5.0.0.yaml
linter:
rules:
parameter_assignments: false

Binary file not shown.

Binary file not shown.

30
components/in_app_review/.gitignore vendored Normal file
View File

@ -0,0 +1,30 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
/pubspec.lock
**/doc/api/
.dart_tool/
.packages
build/

View File

@ -0,0 +1,39 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled.
version:
revision: e3c29ec00c9c825c891d75054c63fcc46454dca1
channel: stable
project_type: plugin
# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: e3c29ec00c9c825c891d75054c63fcc46454dca1
base_revision: e3c29ec00c9c825c891d75054c63fcc46454dca1
- platform: android
create_revision: e3c29ec00c9c825c891d75054c63fcc46454dca1
base_revision: e3c29ec00c9c825c891d75054c63fcc46454dca1
- platform: ios
create_revision: e3c29ec00c9c825c891d75054c63fcc46454dca1
base_revision: e3c29ec00c9c825c891d75054c63fcc46454dca1
- platform: macos
create_revision: e3c29ec00c9c825c891d75054c63fcc46454dca1
base_revision: e3c29ec00c9c825c891d75054c63fcc46454dca1
- platform: windows
create_revision: e3c29ec00c9c825c891d75054c63fcc46454dca1
base_revision: e3c29ec00c9c825c891d75054c63fcc46454dca1
# User provided section
# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'

View File

@ -0,0 +1,102 @@
# [2.0.6]
- Update Android Play Core dependency to Play Review 2.0.1.
# [2.0.5]
- Migrate Android Play Core dependency to Play Review 2.0.0.
- Recreate the example app.
- Update in_app_review_platform_interface to 2.0.4
# [2.0.4]
- Migrate maven repository from jcenter to mavenCentral
- `isAvailable()` now returns `false` on web.
# [2.0.3]
- Fix iOS no-scene exception. ([#41](https://github.com/britannio/in_app_review/issues/41))
# [2.0.2]
- Replace iOS Swift code with Objective-C to add compatibility with Objective-C Flutter apps.
# [2.0.1]
- Fix rare null pointer exception on Android
- Fix MissingPluginException on MacOS
- Bump the minimum Dart SDK version from `2.12.0-0` to `2.12.0`.
- Bump the minimum Flutter version to `2.0.0`.
- Update in_app_review_platform_interface to 2.0.2
# [2.0.0]
- Migrate to null safety.
# [1.0.4]
- Update in_app_review_platform_interface to 1.0.5
- Remove dependency on `package_info`.
- Handle `openStoreListing()` with native code for Android, iOS and MacOS.
# [1.0.3]
- Update in_app_review_platform_interface to 1.0.4
- Update android compileSdkVersion to 29.
- Lower dependency version constraints.
# [1.0.2]
- Update in_app_review_platform_interface to 1.0.3
- Open the App Store directly instead of via the Safari View Controller.
- Add automated tests.
- Improve docs.
# [1.0.1+1]
- Update in_app_review_platform_interface to 1.0.2
# [1.0.0]
- Migrate to use `in_app_review_platform_interface`.
- Add Windows support for `openStoreListing`.
# [0.2.1+1]
- Improve iOS testing docs.
# [0.2.1]
- Update dependencies.
- Android Play Core Library V1.8.2 release notes:
- Fixed UI flickering in the In-App Review API
# [0.2.0+4]
- Remove deprecated API warning.
- Update dependencies.
# [0.2.0+3]
- Instructions in the README have been improved along with the example.
# [0.2.0+2]
- Update changelog format
# [0.2.0+1]
- Update MacOS testing instructions
# [0.2.0] Breaking Change
- Add MacOS support
- Rename `openStoreListing(iOSAppStoreId: '')` to `openStoreListing(appStoreId: '')`
# [0.1.0]
- Improve docs
- Set Android minSdkVersion to 16
- Refactor Android Plugin
# [0.0.1]
Initial release

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 Britannio Jarrett
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,9 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.cxx

View File

@ -0,0 +1,49 @@
group 'dev.britannio.in_app_review'
version '1.0-SNAPSHOT'
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 31
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
minSdkVersion 16
}
dependencies {
}
}

View File

@ -0,0 +1 @@
rootProject.name = 'in_app_review'

View File

@ -0,0 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.britannio.in_app_review">
</manifest>

View File

@ -0,0 +1,59 @@
package dev.britannio.in_app_review;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.util.Log;
import androidx.annotation.NonNull;
import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.embedding.engine.plugins.activity.ActivityAware;
import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;
/**
* InAppReviewPlugin
*/
public class InAppReviewPlugin implements FlutterPlugin, MethodCallHandler {
/// The MethodChannel that will the communication between Flutter and native Android
///
/// This local reference serves to register the plugin with the Flutter Engine and unregister it
/// when the Flutter Engine is detached from the Activity
private MethodChannel channel;
private final String TAG = "InAppReviewPlugin";
@Override
public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {
channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "dev.britannio.in_app_review");
channel.setMethodCallHandler(this);
}
@Override
public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
Log.i(TAG, "onMethodCall: " + call.method);
switch (call.method) {
case "isAvailable":
case "requestReview":
case "openStoreListing":
default:
result.notImplemented();
break;
}
}
@Override
public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
channel.setMethodCallHandler(null);
}
}

38
components/in_app_review/ios/.gitignore vendored Normal file
View File

@ -0,0 +1,38 @@
.idea/
.vagrant/
.sconsign.dblite
.svn/
.DS_Store
*.swp
profile
DerivedData/
build/
GeneratedPluginRegistrant.h
GeneratedPluginRegistrant.m
.generated/
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
!default.pbxuser
!default.mode1v3
!default.mode2v3
!default.perspectivev3
xcuserdata
*.moved-aside
*.pyc
*sync/
Icon?
.tags*
/Flutter/Generated.xcconfig
/Flutter/ephemeral/
/Flutter/flutter_export_environment.sh

View File

@ -0,0 +1,4 @@
#import <Flutter/Flutter.h>
@interface InAppReviewPlugin : NSObject<FlutterPlugin>
@end

View File

@ -0,0 +1,107 @@
#import "InAppReviewPlugin.h"
@import StoreKit;
@implementation InAppReviewPlugin
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
FlutterMethodChannel* channel = [FlutterMethodChannel methodChannelWithName:@"dev.britannio.in_app_review" binaryMessenger:[registrar messenger]];
InAppReviewPlugin* instance = [[InAppReviewPlugin alloc] init];
[registrar addMethodCallDelegate:instance channel:channel];
}
- (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result {
[self logMessage:@"handle" details:call.method];
if ([call.method isEqual:@"requestReview"]) {
[self requestReview:result];
} else if ([call.method isEqual:@"isAvailable"]) {
[self isAvailable:result];
} else if ([call.method isEqual:@"openStoreListing"]) {
[self openStoreListingWithStoreId:call.arguments result:result];
} else {
[self logMessage:@"method not implemented"];
result(FlutterMethodNotImplemented);
}
}
- (void) requestReview:(FlutterResult)result {
if (@available(iOS 14, *)) {
[self logMessage:@"iOS 14+"];
UIWindowScene *scene = [self findActiveScene];
[SKStoreReviewController requestReviewInScene:scene];
result(nil);
} else if (@available(iOS 10.3, *)) {
[self logMessage:@"iOS 10.3+"];
[SKStoreReviewController requestReview];
result(nil);
} else {
result([FlutterError errorWithCode:@"unavailable"
message:@"In-App Review unavailable"
details:nil]);
}
}
- (UIWindowScene *) findActiveScene API_AVAILABLE(ios(13.0)){
for (UIWindowScene *scene in UIApplication.sharedApplication.connectedScenes) {
if (scene.activationState == UISceneActivationStateForegroundActive) {
return scene;
}
}
return nil;
}
- (void) isAvailable:(FlutterResult)result {
if (@available(iOS 10.3, *)) {
[self logMessage:@"available"];
result(@YES);
} else {
[self logMessage:@"unavailable"];
result(@NO);
}
}
- (void) openStoreListingWithStoreId:(NSString *)storeId result:(FlutterResult)result {
if (!storeId) {
result([FlutterError errorWithCode:@"no-store-id"
message:@"Your store id must be passed as the method channel's argument"
details:nil]);
return;
}
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://apps.apple.com/app/id%@?action=write-review", storeId]];
if (!url) {
result([FlutterError errorWithCode:@"url-construct-fail"
message:@"Failed to construct url"
details:nil]);
return;
}
UIApplication *app = [UIApplication sharedApplication];
if (@available(iOS 10.0, *)) {
[app openURL:url options:@{} completionHandler:nil];
} else {
[app openURL:url];
}
}
#pragma mark - Logging Helpers
- (void) logMessage:(NSString *) message {
NSLog(@"InAppReviewPlugin: %@", message);
}
- (void) logMessage:(NSString *) message
details:(NSString *) details {
NSLog(@"InAppReviewPlugin: %@ %@", message, details);
}
@end

View File

@ -0,0 +1,23 @@
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
# Run `pod lib lint in_app_review.podspec` to validate before publishing.
#
Pod::Spec.new do |s|
s.name = 'in_app_review'
s.version = '0.2.0'
s.summary = 'Flutter plugin for showing the In-App Review/System Rating pop up.'
s.description = <<-DESC
Flutter plugin for showing the In-App Review/System Rating pop up..
DESC
s.homepage = 'http://example.com'
s.license = { :file => '../LICENSE' }
s.author = { 'Britannio Jarrett' => 'britanniojarrett@gmail.com' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.dependency 'Flutter'
s.platform = :ios, '9.0'
# Flutter.framework does not contain a i386 slice.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
s.swift_version = '5.0'
end

View File

@ -0,0 +1,50 @@
import 'dart:async';
import 'package:in_app_review_platform_interface/in_app_review_platform_interface.dart';
class InAppReview {
InAppReview._();
static final InAppReview instance = InAppReview._();
/// Checks if the device is able to show a review dialog.
///
/// On Android the Google Play Store must be installed and the device must be
/// running **Android 5 Lollipop(API 21)** or higher.
///
/// iOS devices must be running **iOS version 10.3** or higher.
///
/// MacOS devices must be running **MacOS version 10.14** or higher
Future<bool> isAvailable() => InAppReviewPlatform.instance.isAvailable();
/// Attempts to show the review dialog. It's recommended to first check if
/// the device supports this feature via [isAvailable].
///
/// To improve the users experience, iOS and Android enforce limitations
/// that might prevent this from working after a few tries. iOS & MacOS users
/// can also disable this feature entirely in the App Store settings.
///
/// More info and guidance:
/// https://developer.android.com/guide/playcore/in-app-review#when-to-request
/// https://developer.apple.com/design/human-interface-guidelines/ios/system-capabilities/ratings-and-reviews/
/// https://developer.apple.com/design/human-interface-guidelines/macos/system-capabilities/ratings-and-reviews/
Future<void> requestReview() => InAppReviewPlatform.instance.requestReview();
/// Opens the Play Store on Android, the App Store with a review
/// screen on iOS & MacOS and the Microsoft Store on Windows.
///
/// [appStoreId] is required for iOS & MacOS.
///
/// [microsoftStoreId] is required for Windows.
Future<void> openStoreListing({
/// Required for iOS & MacOS.
String? appStoreId,
/// Required for Windows.
String? microsoftStoreId,
}) =>
InAppReviewPlatform.instance.openStoreListing(
appStoreId: appStoreId,
microsoftStoreId: microsoftStoreId,
);
}

View File

@ -0,0 +1,42 @@
import Cocoa
import FlutterMacOS
import StoreKit
public class InAppReviewPlugin: NSObject, FlutterPlugin {
public static func register(with registrar: FlutterPluginRegistrar) {
let channel = FlutterMethodChannel(name: "dev.britannio.in_app_review", binaryMessenger: registrar.messenger)
let instance = InAppReviewPlugin()
registrar.addMethodCallDelegate(instance, channel: channel)
}
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
switch call.method {
case "requestReview":
//App Store Review
if #available(OSX 10.14, *) {
SKStoreReviewController.requestReview()
result(nil)
} else {
result(FlutterError(code: "unavailable", message: "In-App Review unavailable", details: nil))
}
case "isAvailable":
if #available(OSX 10.14, *) {
result(true)
} else {
result(false)
}
case "openStoreListing":
let storeId : String = call.arguments as! String;
guard let writeReviewURL = URL(string: "macappstore://apps.apple.com/app/id" + storeId + "?action=write-review")
else {
result(FlutterError(code: "url_construct_fail", message: "Failed to construct url", details: nil))
return
}
NSWorkspace.shared.open(writeReviewURL)
result(nil);
default:
result(FlutterMethodNotImplemented)
}
}
}

View File

@ -0,0 +1,22 @@
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
# Run `pod lib lint in_app_review.podspec' to validate before publishing.
#
Pod::Spec.new do |s|
s.name = 'in_app_review'
s.version = '0.2.0'
s.summary = 'Flutter plugin for showing the In-App Review/System Rating pop up.'
s.description = <<-DESC
Flutter plugin for showing the In-App Review/System Rating pop up.
DESC
s.homepage = 'https://github.com/britannio/in_app_review'
s.license = { :file => '../LICENSE' }
s.author = { 'Britannio Jarrett' => 'britanniojarrett@gmail.com' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.dependency 'FlutterMacOS'
s.platform = :osx, '10.11'
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
s.swift_version = '5.0'
end

View File

@ -0,0 +1,46 @@
name: in_app_review
description: Flutter plugin for showing the In-App Review/System Rating pop up on Android, iOS and MacOS. It makes it easy for users to rate your app.
version: 2.0.6
homepage: https://github.com/britannio/in_app_review/tree/master/in_app_review
environment:
sdk: '>=2.12.0 <3.0.0'
flutter: ">=2.0.0"
dependencies:
flutter:
sdk: flutter
in_app_review_platform_interface: ^2.0.4
dev_dependencies:
flutter_test:
sdk: flutter
mockito: ^5.0.0
plugin_platform_interface: ^2.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter packages.
flutter:
# This section identifies this Flutter project as a plugin project.
# The 'pluginClass' specifies the class (in Java, Kotlin, Swift, Objective-C, etc.)
# which should be registered in the plugin registry. This is required for
# using method channels.
# The Android 'package' specifies package in which the registered class is.
# This is required for using method channels on Android.
# The 'ffiPlugin' specifies that native code should be built and bundled.
# This is required for using `dart:ffi`.
# All these are used by the tooling to maintain consistency when
# adding or updating assets for this project.
plugin:
platforms:
android:
package: dev.britannio.in_app_review
pluginClass: InAppReviewPlugin
ios:
pluginClass: InAppReviewPlugin
macos:
pluginClass: InAppReviewPlugin

View File

@ -0,0 +1,12 @@
.DS_Store
.dart_tool/
.packages
.pub/
build/
pubspec.lock
.flutter-plugins
.flutter-plugins-dependencies

View File

@ -0,0 +1,46 @@
# [2.0.4]
- Update usage of `pkg:url_launcher` to address deprecations.
# [2.0.3]
- `isAvailable()` now returns `false` on web.
# [2.0.2]
- Bump the minimum Flutter version to `2.0.0`.
# [2.0.1]
- Bump the minimum Dart SDK version from `2.12.0-0` to `2.12.0`.
# [2.0.0]
- Migrate to null safety.
# [1.0.5]
- Remove dependency on `package_info`.
- Handle `openStoreListing()` with native code for Android, iOS and MacOS.
# [1.0.4]
- Lower dependency version constraints
# [1.0.3]
- Open the App Store directly instead of via the Safari View Controller.
- Add automated tests.
# [1.0.2]
- Rename `openStoreListing(windowsStoreId: '')` to `openStoreListing(microsoftStoreId: '')`.
- Update dependencies.
# [1.0.1]
- Remove unnecessary files.
# [1.0.0]
- Initial release.

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 Britannio Jarrett
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,26 @@
# in_app_review_platform_interface
A common platform interface for the [`in_app_review`][1] plugin.
This interface allows platform-specific implementations of the `in_app_review`
plugin, as well as the plugin itself, to ensure they are supporting the
same interface.
# Usage
To implement a new platform-specific implementation of `in_app_review`, extend
[`InAppReviewPlatform`][2] with an implementation that performs the
platform-specific behavior, and when you register your plugin, set the default
`InAppReviewPlatform` by calling
`InAppReviewPlatform.instance = MyInAppReview()`.
# Note on breaking changes
Strongly prefer non-breaking changes (such as adding a method to the interface)
over breaking changes for this package.
See https://flutter.dev/go/platform-interface-breaking-changes for a discussion
on why a less-clean interface is preferable to a breaking change.
[1]: ../in_app_review
[2]: lib/in_app_review_platform_interface.dart

View File

@ -0,0 +1,71 @@
import 'package:in_app_review_platform_interface/method_channel_in_app_review.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
/// The interface that implementations of in_app_review must implement.
///
/// Platform implementations should extend this class rather than implement it
/// as `in_app_review` does not consider newly added methods to be breaking
/// changes. Extending this class (using `extends`) ensures that the subclass
/// will get the default implementation, while platform implementations that
/// `implements` this interface will be broken by newly added
/// [InAppReviewPlatform] methods.
abstract class InAppReviewPlatform extends PlatformInterface {
InAppReviewPlatform() : super(token: _token);
static InAppReviewPlatform _instance = MethodChannelInAppReview();
static final Object _token = Object();
static InAppReviewPlatform get instance => _instance;
/// Platform-specific plugins should set this with their own platform-specific
/// class that extends [InAppReviewPlatform] when they register themselves.
static set instance(InAppReviewPlatform instance) {
PlatformInterface.verifyToken(instance, _token);
_instance = instance;
}
/// Checks if the device is able to show a review dialog.
///
/// On Android the Google Play Store must be installed and the device must be
/// running **Android 5 Lollipop(API 21)** or higher.
///
/// iOS devices must be running **iOS version 10.3** or higher.
///
/// MacOS devices must be running **MacOS version 10.14** or higher
Future<bool> isAvailable() {
throw UnimplementedError('isAvailable() has not been implemented.');
}
/// Attempts to show the review dialog. It's recommended to first check if
/// this cannot be done via [isAvailable]. If it is not available then
/// you can open the store listing via [openStoreListing].
///
/// To improve the users experience, iOS and Android enforce limitations
/// that might prevent this from working after a few tries. iOS & MacOS users
/// can also disable this feature entirely in the App Store settings.
///
/// More info and guidance:
/// https://developer.android.com/guide/playcore/in-app-review#when-to-request
/// https://developer.apple.com/design/human-interface-guidelines/ios/system-capabilities/ratings-and-reviews/
/// https://developer.apple.com/design/human-interface-guidelines/macos/system-capabilities/ratings-and-reviews/
Future<void> requestReview() {
throw UnimplementedError('requestReview() has not been implemented.');
}
/// Opens the Play Store on Android, the App Store with a review
/// screen on iOS & MacOS and the Microsoft Store on Windows.
///
/// [appStoreId] is required for iOS & MacOS.
///
/// [microsoftStoreId] is required for Windows.
Future<void> openStoreListing({
/// Required for iOS & MacOS.
String? appStoreId,
/// Required for Windows.
String? microsoftStoreId,
}) {
throw UnimplementedError('openStoreListing() has not been implemented.');
}
}

View File

@ -0,0 +1,65 @@
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:platform/platform.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'in_app_review_platform_interface.dart';
/// An implementation of [InAppReviewPlatform] that uses method channels.
class MethodChannelInAppReview extends InAppReviewPlatform {
MethodChannel _channel = MethodChannel('dev.britannio.in_app_review');
Platform _platform = const LocalPlatform();
@visibleForTesting
set channel(MethodChannel channel) => _channel = channel;
@visibleForTesting
set platform(Platform platform) => _platform = platform;
@override
Future<bool> isAvailable() async {
if (kIsWeb) return false;
return _channel
.invokeMethod<bool>('isAvailable')
.then((bool? available) => available ?? false, onError: (_) => false);
}
@override
Future<void> requestReview() => _channel.invokeMethod('requestReview');
@override
Future<void> openStoreListing({
String? appStoreId,
String? microsoftStoreId,
}) async {
final bool isiOS = _platform.isIOS;
final bool isMacOS = _platform.isMacOS;
final bool isAndroid = _platform.isAndroid;
final bool isWindows = _platform.isWindows;
if (isiOS || isMacOS) {
await _channel.invokeMethod(
'openStoreListing',
ArgumentError.checkNotNull(appStoreId, 'appStoreId'),
);
} else if (isAndroid) {
await _channel.invokeMethod('openStoreListing');
} else if (isWindows) {
ArgumentError.checkNotNull(microsoftStoreId, 'microsoftStoreId');
await _launchUrl(
'ms-windows-store://review/?ProductId=$microsoftStoreId',
);
} else {
throw UnsupportedError(
'Platform(${_platform.operatingSystem}) not supported',
);
}
}
Future<void> _launchUrl(String url) async {
if (!await canLaunchUrlString(url)) return;
await launchUrlString(url, mode: LaunchMode.externalNonBrowserApplication);
}
}

View File

@ -0,0 +1,24 @@
name: in_app_review_platform_interface
description: A common platform interface for the in_app_review plugin.
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
version: 2.0.4
homepage: https://github.com/britannio/in_app_review/tree/master/in_app_review_platform_interface
environment:
sdk: '>=2.12.0 <3.0.0'
flutter: ">=2.0.0"
dependencies:
flutter:
sdk: flutter
url_launcher: ^6.1.0
plugin_platform_interface: ^2.0.0
platform: ^3.0.0
dev_dependencies:
flutter_test:
sdk: flutter

View File

@ -0,0 +1,121 @@
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:in_app_review_platform_interface/method_channel_in_app_review.dart';
import 'package:platform/platform.dart';
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
late MethodChannelInAppReview methodChannelInAppReview;
late List<MethodCall> log = <MethodCall>[];
const MethodChannel channel = MethodChannel('dev.britannio.in_app_review');
setUp(() {
methodChannelInAppReview = MethodChannelInAppReview();
methodChannelInAppReview.channel = channel;
log = <MethodCall>[];
});
tearDown(() {
log.clear();
});
group('isAvailable', () {
test(
'should invoke the isAvailable method channel',
() async {
// ACT
final bool result = await methodChannelInAppReview.isAvailable();
// ASSERT
expect(log, <Matcher>[isMethodCall('isAvailable', arguments: null)]);
expect(result, isTrue);
},
);
});
group('requestReview', () {
test(
'should invoke the requestReview method channel',
() async {
// ACT
await methodChannelInAppReview.requestReview();
// ASSERT
expect(log, <Matcher>[isMethodCall('requestReview', arguments: null)]);
},
);
});
group('openStoreListing', () {
test(
'should invoke the openStoreListing method channel on Android',
() async {
// ARRANGE
methodChannelInAppReview.platform =
FakePlatform(operatingSystem: 'android');
// ACT
await methodChannelInAppReview.openStoreListing();
// ASSERT
expect(
log,
<Matcher>[isMethodCall('openStoreListing', arguments: null)],
);
},
);
test(
'should invoke the openStoreListing method channel on iOS',
() async {
// ARRANGE
methodChannelInAppReview.platform =
FakePlatform(operatingSystem: 'ios');
final String appStoreId = "store_id";
// ACT
await methodChannelInAppReview.openStoreListing(appStoreId: appStoreId);
// ASSERT
expect(log,
<Matcher>[isMethodCall('openStoreListing', arguments: appStoreId)]);
},
);
test(
'should invoke the openStoreListing method channel on MacOS',
() async {
// ARRANGE
methodChannelInAppReview.platform =
FakePlatform(operatingSystem: 'macos');
final String appStoreId = "store_id";
// ACT
await methodChannelInAppReview.openStoreListing(appStoreId: appStoreId);
// ASSERT
expect(log,
<Matcher>[isMethodCall('openStoreListing', arguments: appStoreId)]);
},
);
test(
'should invoke the openStoreListing method channel on Windows',
() async {
// ARRANGE
methodChannelInAppReview.platform =
FakePlatform(operatingSystem: 'windows');
final String microsoftStoreId = 'store_id';
// ACT
await methodChannelInAppReview.openStoreListing(
microsoftStoreId: microsoftStoreId,
);
// ASSERT
expect(log, <Matcher>[
isMethodCall('openStoreListing', arguments: microsoftStoreId)
]);
},
skip:
'The windows uwp implementation still uses the url_launcher package',
);
});
}

View File

@ -0,0 +1 @@
- Navigation shortcuts.

View File

@ -23,6 +23,8 @@ PODS:
- FMDB (2.7.5):
- FMDB/standard (= 2.7.5)
- FMDB/standard (2.7.5)
- in_app_review (0.2.0):
- Flutter
- integration_test (0.0.1):
- Flutter
- OrderedSet (5.0.0)
@ -39,7 +41,7 @@ PODS:
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- sqflite (0.0.2):
- sqflite (0.0.3):
- Flutter
- FMDB (>= 2.7.5)
- synced_shared_preferences (0.0.1):
@ -62,12 +64,13 @@ DEPENDENCIES:
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
- flutter_siri_suggestions (from `.symlinks/plugins/flutter_siri_suggestions/ios`)
- in_app_review (from `.symlinks/plugins/in_app_review/ios`)
- integration_test (from `.symlinks/plugins/integration_test/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- receive_sharing_intent (from `.symlinks/plugins/receive_sharing_intent/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)
- synced_shared_preferences (from `.symlinks/plugins/synced_shared_preferences/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
@ -98,18 +101,20 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/flutter_secure_storage/ios"
flutter_siri_suggestions:
:path: ".symlinks/plugins/flutter_siri_suggestions/ios"
in_app_review:
:path: ".symlinks/plugins/in_app_review/ios"
integration_test:
:path: ".symlinks/plugins/integration_test/ios"
package_info_plus:
:path: ".symlinks/plugins/package_info_plus/ios"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/ios"
:path: ".symlinks/plugins/path_provider_foundation/darwin"
receive_sharing_intent:
:path: ".symlinks/plugins/receive_sharing_intent/ios"
share_plus:
:path: ".symlinks/plugins/share_plus/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/ios"
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
sqflite:
:path: ".symlinks/plugins/sqflite/ios"
synced_shared_preferences:
@ -124,8 +129,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/workmanager/ios"
SPEC CHECKSUMS:
connectivity_plus: 413a8857dd5d9f1c399a39130850d02fe0feaf7e
device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed
connectivity_plus: 07c49e96d7fc92bc9920617b83238c4d178b446a
device_info_plus: 7545d84d8d1b896cb16a4ff98c19f07ec4b298ea
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_email_sender: 02d7443217d8c41483223627972bfdc09f74276b
flutter_inappwebview: bfd58618f49dc62f2676de690fc6dcda1d6c3721
@ -133,19 +138,20 @@ SPEC CHECKSUMS:
flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be
flutter_siri_suggestions: 226fb7ef33d25d3fe0d4aa2a8bcf4b72730c466f
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
integration_test: a1e7d09bd98eca2fc37aefd79d4f41ad37bdbbe5
in_app_review: 318597b3a06c22bb46dc454d56828c85f444f99d
integration_test: 13825b8a9334a850581300559b8839134b124670
OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852
package_info_plus: fd030dabf36271f146f1f3beacd48f564b0f17f7
path_provider_foundation: eaf5b3e458fc0e5fbb9940fb09980e853fe058b8
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
receive_sharing_intent: c0d87310754e74c0f9542947e7cbdf3a0335a3b1
share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68
shared_preferences_foundation: 297b3ebca31b34ec92be11acd7fb0ba932c822ca
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
share_plus: 599aa54e4ea31d4b4c0e9c911bcc26c55e791028
shared_preferences_foundation: e2dae3258e06f44cc55f49d42024fd8dd03c590c
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
synced_shared_preferences: f722742b06d65c7315b8e9f56b794c9fbd5597f7
url_launcher_ios: fb12c43172927bb5cf75aeebd073f883801f1993
url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f
webview_flutter_wkwebview: b7e70ef1ddded7e69c796c7390ee74180182971f
webview_flutter_wkwebview: 2e2d318f21a5e036e2c3f26171342e95908bd60a
workmanager: 0afdcf5628bbde6924c21af7836fed07b42e30e6
PODFILE CHECKSUM: d28e9a1c7bee335d05ddd795703aad5bf05bb937

View File

@ -10,6 +10,7 @@
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
7A6CD5D595D5F4E8710804C0 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8BF0A917F40A838BF30D8F4C /* Pods_Runner.framework */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
@ -22,7 +23,6 @@
E530B1B0283B54DA004E8EB6 /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E530B1AE283B54DA004E8EB6 /* MainInterface.storyboard */; };
E530B1B4283B54DA004E8EB6 /* Action Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = E530B1A6283B54DA004E8EB6 /* Action Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
E575B6F127EBC6DB002B1508 /* CloudKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E575B6F027EBC6DA002B1508 /* CloudKit.framework */; };
FC507E94AA7767C155787DB3 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BFB5AA41D6C22D228077D166 /* Pods_Runner.framework */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -68,14 +68,14 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
027B292CC58CF92F11FC0A69 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
0E63A5CE3FDBCCD054072136 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
4449F5D4D39C23F292D07005 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
8BF0A917F40A838BF30D8F4C /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
@ -83,8 +83,8 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
BFB5AA41D6C22D228077D166 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
DF5D5FFF325B7D5DFEE88A3F /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
B9EC882BDD04A309C317E416 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
D73EA9FA5E6F35364DCA0CD1 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
E51D52AD283B464E00FC8DD8 /* Share Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Share Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
E51D52AF283B464E00FC8DD8 /* ShareViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareViewController.swift; sourceTree = "<group>"; };
E51D52B2283B464E00FC8DD8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = "<group>"; };
@ -107,7 +107,7 @@
buildActionMask = 2147483647;
files = (
E575B6F127EBC6DB002B1508 /* CloudKit.framework in Frameworks */,
FC507E94AA7767C155787DB3 /* Pods_Runner.framework in Frameworks */,
7A6CD5D595D5F4E8710804C0 /* Pods_Runner.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -183,8 +183,8 @@
isa = PBXGroup;
children = (
E575B6F027EBC6DA002B1508 /* CloudKit.framework */,
BFB5AA41D6C22D228077D166 /* Pods_Runner.framework */,
E530B1A7283B54DA004E8EB6 /* UniformTypeIdentifiers.framework */,
8BF0A917F40A838BF30D8F4C /* Pods_Runner.framework */,
);
name = Frameworks;
sourceTree = "<group>";
@ -192,9 +192,9 @@
D79CD63C88FF49EF451AFDDF /* Pods */ = {
isa = PBXGroup;
children = (
DF5D5FFF325B7D5DFEE88A3F /* Pods-Runner.debug.xcconfig */,
4449F5D4D39C23F292D07005 /* Pods-Runner.release.xcconfig */,
027B292CC58CF92F11FC0A69 /* Pods-Runner.profile.xcconfig */,
0E63A5CE3FDBCCD054072136 /* Pods-Runner.debug.xcconfig */,
D73EA9FA5E6F35364DCA0CD1 /* Pods-Runner.release.xcconfig */,
B9EC882BDD04A309C317E416 /* Pods-Runner.profile.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
@ -229,15 +229,15 @@
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
41DC8215F9CFD708C36ECBA8 /* [CP] Check Pods Manifest.lock */,
E2E6E097A94005D9196D0A71 /* [CP] Check Pods Manifest.lock */,
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
7714A105B2069B720D0DF18E /* [CP] Embed Pods Frameworks */,
E51D52B8283B464E00FC8DD8 /* Embed App Extensions */,
F1959755D5521D58CA193498 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
@ -365,6 +365,7 @@
files = (
);
inputPaths = (
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
@ -373,7 +374,22 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
41DC8215F9CFD708C36ECBA8 /* [CP] Check Pods Manifest.lock */ = {
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Run Script";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
E2E6E097A94005D9196D0A71 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
@ -395,7 +411,7 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
7714A105B2069B720D0DF18E /* [CP] Embed Pods Frameworks */ = {
F1959755D5521D58CA193498 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
@ -412,21 +428,6 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Run Script";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@ -565,11 +566,9 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = QMWX3X2NF7;
DEVELOPMENT_TEAM = QMWX3X2NF7;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Hacki;
@ -583,7 +582,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.jiaqi.hacki;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "match Development com.jiaqi.hacki";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
@ -707,11 +705,9 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = QMWX3X2NF7;
DEVELOPMENT_TEAM = QMWX3X2NF7;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Hacki;
@ -725,7 +721,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.jiaqi.hacki;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "match Development com.jiaqi.hacki";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
@ -780,11 +775,9 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_ENTITLEMENTS = "Share Extension/Share Extension.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = QMWX3X2NF7;
DEVELOPMENT_TEAM = QMWX3X2NF7;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "Share Extension/Info.plist";
@ -802,7 +795,6 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.jiaqi.hacki.Share-Extension";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "hacki share extension profile";
SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_EMIT_LOC_STRINGS = YES;
@ -863,11 +855,9 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_ENTITLEMENTS = "Share Extension/Share Extension.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = QMWX3X2NF7;
DEVELOPMENT_TEAM = QMWX3X2NF7;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "Share Extension/Info.plist";
@ -884,7 +874,6 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.jiaqi.hacki.Share-Extension";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "hacki share extension profile";
SKIP_INSTALL = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
@ -905,11 +894,9 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_ENTITLEMENTS = "Action Extension/Action Extension.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = QMWX3X2NF7;
DEVELOPMENT_TEAM = QMWX3X2NF7;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "Action Extension/Info.plist";
@ -927,7 +914,6 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.jiaqi.hacki.Action-Extension";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "hacki action extension profile";
SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_EMIT_LOC_STRINGS = YES;
@ -992,11 +978,9 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_ENTITLEMENTS = "Action Extension/Action Extension.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = QMWX3X2NF7;
DEVELOPMENT_TEAM = QMWX3X2NF7;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "Action Extension/Info.plist";
@ -1013,7 +997,6 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.jiaqi.hacki.Action-Extension";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "hacki action extension profile";
SKIP_INSTALL = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;

View File

@ -39,6 +39,8 @@ abstract class Constants {
static const String featureOpenStoryInWebView = 'open_story_in_web_view';
static const String featureLogIn = 'log_in';
static const String featurePinToTop = 'pin_to_top';
static const String featureJumpUpButton = 'jump_up_button';
static const String featureJumpDownButton = 'jump_down_button';
static final String happyFace = <String>[
'(๑•̀ㅂ•́)و✧',

View File

@ -32,7 +32,8 @@ Future<void> setUpLocator() async {
..registerSingleton<OfflineRepository>(OfflineRepository())
..registerSingleton<DraftCache>(DraftCache())
..registerSingleton<CommentCache>(CommentCache())
..registerSingleton<LocalNotification>(LocalNotification())
..registerSingleton<LocalNotificationService>(LocalNotificationService())
..registerSingleton(AppReviewService())
..registerSingleton<RouteObserver<ModalRoute<dynamic>>>(
RouteObserver<ModalRoute<dynamic>>(),
);

View File

@ -3,7 +3,6 @@ import 'dart:async';
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:hacki/config/locator.dart';
import 'package:hacki/cubits/cubits.dart';
import 'package:hacki/services/services.dart';
part 'collapse_state.dart';
@ -11,16 +10,13 @@ part 'collapse_state.dart';
class CollapseCubit extends Cubit<CollapseState> {
CollapseCubit({
required int commentId,
required CommentsCubit? commentsCubit,
CollapseCache? collapseCache,
}) : _commentId = commentId,
_collapseCache = collapseCache ?? locator.get<CollapseCache>(),
_commentsCubit = commentsCubit,
super(const CollapseState.init());
final int _commentId;
final CollapseCache _collapseCache;
final CommentsCubit? _commentsCubit;
late final StreamSubscription<Map<int, Set<int>>> _streamSubscription;
void init() {
@ -47,16 +43,7 @@ class CollapseCubit extends Cubit<CollapseState> {
),
);
} else {
if (_commentsCubit == null) return;
final Set<int> collapsedCommentIds = _collapseCache.collapse(_commentId);
final int lastCommentId = _commentsCubit!.state.comments.last.id;
final bool shouldLoadMore = _commentId == lastCommentId ||
collapsedCommentIds.contains(lastCommentId);
if (shouldLoadMore) {
_commentsCubit!.loadMore();
}
emit(
state.copyWith(

View File

@ -1,10 +1,10 @@
import 'dart:async';
import 'dart:math';
import 'package:bloc/bloc.dart';
import 'package:collection/collection.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:hacki/config/locator.dart';
import 'package:hacki/cubits/cubits.dart';
import 'package:hacki/main.dart';
@ -12,10 +12,11 @@ import 'package:hacki/models/models.dart';
import 'package:hacki/repositories/repositories.dart';
import 'package:hacki/screens/screens.dart';
import 'package:hacki/services/services.dart';
import 'package:hacki/utils/linkifier_util.dart';
import 'package:hacki/utils/utils.dart';
import 'package:linkify/linkify.dart';
import 'package:logger/logger.dart';
import 'package:rxdart/rxdart.dart';
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
part 'comments_state.dart';
@ -23,15 +24,15 @@ class CommentsCubit extends Cubit<CommentsState> {
CommentsCubit({
required FilterCubit filterCubit,
required CollapseCache collapseCache,
required bool isOfflineReading,
required Item item,
required FetchMode defaultFetchMode,
required CommentsOrder defaultCommentsOrder,
CommentCache? commentCache,
OfflineRepository? offlineRepository,
StoriesRepository? storiesRepository,
SembastRepository? sembastRepository,
Logger? logger,
required bool isOfflineReading,
required Item item,
required FetchMode defaultFetchMode,
required CommentsOrder defaultCommentsOrder,
}) : _filterCubit = filterCubit,
_collapseCache = collapseCache,
_commentCache = commentCache ?? locator.get<CommentCache>(),
@ -68,8 +69,6 @@ class CommentsCubit extends Cubit<CommentsState> {
final Map<int, StreamSubscription<Comment>> _streamSubscriptions =
<int, StreamSubscription<Comment>>{};
static const int _pageSize = 20;
@override
void emit(CommentsState state) {
if (!isClosed) {
@ -117,7 +116,7 @@ class CommentsCubit extends Cubit<CommentsState> {
? item
: await _storiesRepository.fetchItem(id: item.id).then(_toBuildable) ??
item;
final List<int> kids = sortKids(updatedItem.kids);
final List<int> kids = _sortKids(updatedItem.kids);
emit(state.copyWith(item: updatedItem));
@ -132,13 +131,11 @@ class CommentsCubit extends Cubit<CommentsState> {
ids: kids,
getFromCache: useCommentCache ? _commentCache.getComment : null,
);
break;
case FetchMode.eager:
commentStream = _storiesRepository.fetchAllCommentsRecursivelyStream(
ids: kids,
getFromCache: useCommentCache ? _commentCache.getComment : null,
);
break;
}
}
@ -183,7 +180,7 @@ class CommentsCubit extends Cubit<CommentsState> {
final Item item = state.item;
final Item updatedItem =
await _storiesRepository.fetchItem(id: item.id) ?? item;
final List<int> kids = sortKids(updatedItem.kids);
final List<int> kids = _sortKids(updatedItem.kids);
late final Stream<Comment> commentStream;
if (state.fetchMode == FetchMode.lazy) {
@ -210,7 +207,7 @@ class CommentsCubit extends Cubit<CommentsState> {
}
void loadAll(Story story) {
HapticFeedback.lightImpact();
HapticFeedbackUtil.light();
emit(
state.copyWith(
onlyShowTargetComment: false,
@ -221,7 +218,11 @@ class CommentsCubit extends Cubit<CommentsState> {
}
/// [comment] is only used for lazy fetching.
void loadMore({Comment? comment}) {
void loadMore({
Comment? comment,
void Function(Comment)? onCommentFetched,
VoidCallback? onDone,
}) {
if (comment == null && state.status == CommentsStatus.loading) return;
switch (state.fetchMode) {
@ -265,22 +266,21 @@ class CommentsCubit extends Cubit<CommentsState> {
});
_streamSubscriptions[comment.id] = streamSubscription;
break;
case FetchMode.eager:
if (_streamSubscription != null) {
emit(state.copyWith(status: CommentsStatus.loading));
_streamSubscription?.resume();
_streamSubscription
?..resume()
..onData(onCommentFetched);
}
break;
}
}
Future<void> loadParentThread() async {
unawaited(HapticFeedback.lightImpact());
HapticFeedbackUtil.light();
emit(state.copyWith(fetchParentStatus: CommentsStatus.loading));
final Story? parent = await _storiesRepository
.fetchParentStory(id: state.item.id)
.then(_toBuildableStory);
final Item? parent =
await _storiesRepository.fetchItem(id: state.item.parent);
if (parent == null) {
return;
@ -298,10 +298,33 @@ class CommentsCubit extends Cubit<CommentsState> {
}
}
Future<void> loadRootThread() async {
HapticFeedbackUtil.light();
emit(state.copyWith(fetchRootStatus: CommentsStatus.loading));
final Story? parent = await _storiesRepository
.fetchParentStory(id: state.item.id)
.then(_toBuildableStory);
if (parent == null) {
return;
} else {
await HackiApp.navigatorKey.currentState?.pushNamed(
ItemScreen.routeName,
arguments: ItemScreenArgs(item: parent),
);
emit(
state.copyWith(
fetchRootStatus: CommentsStatus.loaded,
),
);
}
}
void onOrderChanged(CommentsOrder? order) {
if (order == null) return;
if (state.order == order) return;
HapticFeedback.selectionClick();
HapticFeedbackUtil.selection();
_streamSubscription?.cancel();
for (final StreamSubscription<Comment> s in _streamSubscriptions.values) {
s.cancel();
@ -315,7 +338,7 @@ class CommentsCubit extends Cubit<CommentsState> {
if (fetchMode == null) return;
if (state.fetchMode == fetchMode) return;
_collapseCache.resetCollapsedComments();
HapticFeedback.selectionClick();
HapticFeedbackUtil.selection();
_streamSubscription?.cancel();
for (final StreamSubscription<Comment> s in _streamSubscriptions.values) {
s.cancel();
@ -325,7 +348,82 @@ class CommentsCubit extends Cubit<CommentsState> {
init(useCommentCache: true);
}
List<int> sortKids(List<int> kids) {
void jump(
ItemScrollController itemScrollController,
ItemPositionsListener itemPositionsListener,
) {
final int totalComments = state.comments.length;
final List<Comment> onScreenComments = itemPositionsListener
.itemPositions.value
// The header is also a part of the list view,
// thus ignoring it here.
.where((ItemPosition e) => e.index >= 1 && e.itemLeadingEdge < 0.7)
.sorted((ItemPosition a, ItemPosition b) => a.index.compareTo(b.index))
.map(
(ItemPosition e) => e.index <= state.comments.length
? state.comments.elementAt(e.index - 1)
: null,
)
.whereNotNull()
.toList();
/// The index of last comment visible on screen.
final int lastVisibleIndex = state.comments.indexOf(onScreenComments.last);
final int startIndex = min(lastVisibleIndex + 1, totalComments);
for (int i = startIndex; i < totalComments; i++) {
final Comment cmt = state.comments.elementAt(i);
if (cmt.isRoot && (cmt.deleted || cmt.dead) == false) {
itemScrollController.scrollTo(
index: i + 1,
alignment: 0.15,
duration: const Duration(milliseconds: 400),
);
return;
}
}
}
void jumpUp(
ItemScrollController itemScrollController,
ItemPositionsListener itemPositionsListener,
) {
final List<Comment> onScreenComments = itemPositionsListener
.itemPositions.value
// The header is also a part of the list view,
// thus ignoring it here.
.where((ItemPosition e) => e.index >= 1 && e.itemLeadingEdge > 0)
.sorted((ItemPosition a, ItemPosition b) => a.index.compareTo(b.index))
.map(
(ItemPosition e) => e.index <= state.comments.length
? state.comments.elementAt(e.index - 1)
: null,
)
.whereNotNull()
.toList();
/// The index of first comment visible on screen.
final int firstVisibleIndex = state.comments.indexOf(
onScreenComments.firstOrNull ?? state.comments.last,
);
final int startIndex = max(0, firstVisibleIndex - 1);
for (int i = startIndex; i >= 0; i--) {
final Comment cmt = state.comments.elementAt(i);
if (cmt.isRoot && (cmt.deleted || cmt.dead) == false) {
itemScrollController.scrollTo(
index: i + 1,
alignment: 0.15,
duration: const Duration(milliseconds: 400),
);
return;
}
}
}
List<int> _sortKids(List<int> kids) {
switch (state.order) {
case CommentsOrder.natural:
return kids;
@ -361,31 +459,6 @@ class CommentsCubit extends Cubit<CommentsState> {
];
emit(state.copyWith(comments: updatedComments));
if (state.fetchMode == FetchMode.eager) {
if (updatedComments.length >=
_pageSize + _pageSize * state.currentPage &&
updatedComments.length <=
_pageSize * 2 + _pageSize * state.currentPage) {
final bool isHidden = _collapseCache.isHidden(comment.id);
if (!isHidden) {
_streamSubscription?.pause();
emit(
state.copyWith(
status: CommentsStatus.loaded,
),
);
}
emit(
state.copyWith(
currentPage: state.currentPage + 1,
),
);
}
}
}
}

View File

@ -14,6 +14,7 @@ class CommentsState extends Equatable {
required this.comments,
required this.status,
required this.fetchParentStatus,
required this.fetchRootStatus,
required this.order,
required this.fetchMode,
required this.onlyShowTargetComment,
@ -29,6 +30,7 @@ class CommentsState extends Equatable {
}) : comments = <Comment>[],
status = CommentsStatus.init,
fetchParentStatus = CommentsStatus.init,
fetchRootStatus = CommentsStatus.init,
onlyShowTargetComment = false,
currentPage = 0;
@ -36,6 +38,7 @@ class CommentsState extends Equatable {
final List<Comment> comments;
final CommentsStatus status;
final CommentsStatus fetchParentStatus;
final CommentsStatus fetchRootStatus;
final CommentsOrder order;
final FetchMode fetchMode;
final bool onlyShowTargetComment;
@ -47,6 +50,7 @@ class CommentsState extends Equatable {
List<Comment>? comments,
CommentsStatus? status,
CommentsStatus? fetchParentStatus,
CommentsStatus? fetchRootStatus,
CommentsOrder? order,
FetchMode? fetchMode,
bool? onlyShowTargetComment,
@ -57,6 +61,7 @@ class CommentsState extends Equatable {
item: item ?? this.item,
comments: comments ?? this.comments,
fetchParentStatus: fetchParentStatus ?? this.fetchParentStatus,
fetchRootStatus: fetchRootStatus ?? this.fetchRootStatus,
status: status ?? this.status,
order: order ?? this.order,
fetchMode: fetchMode ?? this.fetchMode,
@ -74,6 +79,7 @@ class CommentsState extends Equatable {
item,
status,
fetchParentStatus,
fetchRootStatus,
order,
fetchMode,
onlyShowTargetComment,

View File

@ -67,10 +67,8 @@ class PreferenceCubit extends Cubit<PreferenceState> {
switch (T) {
case int:
_preferenceRepository.setInt(preference.key, value as int);
break;
case bool:
_preferenceRepository.setBool(preference.key, value as bool);
break;
default:
throw UnimplementedError();
}

View File

@ -30,7 +30,6 @@ extension ContextExtension on BuildContext {
textColor: Theme.of(this).textTheme.bodyLarge?.color,
)
: null,
behavior: SnackBarBehavior.floating,
),
);
}

View File

@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:hacki/blocs/auth/auth_bloc.dart';
import 'package:hacki/cubits/cubits.dart';
@ -10,6 +9,7 @@ import 'package:hacki/screens/item/models/models.dart';
import 'package:hacki/screens/item/widgets/widgets.dart';
import 'package:hacki/screens/screens.dart' show ItemScreen, ItemScreenArgs;
import 'package:hacki/styles/styles.dart';
import 'package:hacki/utils/utils.dart';
import 'package:share_plus/share_plus.dart';
extension StateExtension on State {
@ -46,7 +46,7 @@ extension StateExtension on State {
}
void onMoreTapped(Item item, Rect? rect) {
HapticFeedback.lightImpact();
HapticFeedbackUtil.light();
if (item.dead || item.deleted) {
return;
@ -75,16 +75,12 @@ extension StateExtension on State {
break;
case MenuAction.fav:
onFavTapped(item);
break;
case MenuAction.share:
onShareTapped(item, rect);
break;
case MenuAction.flag:
onFlagTapped(item);
break;
case MenuAction.block:
onBlockTapped(item, isBlocked: isBlocked);
break;
case MenuAction.cancel:
break;
}

View File

@ -7,7 +7,6 @@ import 'package:equatable/equatable.dart';
import 'package:feature_discovery/feature_discovery.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
@ -18,7 +17,6 @@ import 'package:hacki/config/locator.dart';
import 'package:hacki/cubits/cubits.dart';
import 'package:hacki/models/models.dart';
import 'package:hacki/screens/screens.dart';
import 'package:hacki/services/custom_bloc_observer.dart';
import 'package:hacki/services/fetcher.dart';
import 'package:hacki/styles/styles.dart';
import 'package:hacki/utils/theme_util.dart';
@ -140,11 +138,8 @@ Future<void> main({bool testing = false}) async {
prefs.getInt(FontPreference().key) ?? Font.roboto.index,
);
// ignore: prefer_asserts_with_message
assert(() {
Bloc.observer = CustomBlocObserver();
return true;
}());
//Uncomment this line to log events from bloc/cubit.
//Bloc.observer = CustomBlocObserver();
HydratedBloc.storage = storage;
@ -159,10 +154,10 @@ Future<void> main({bool testing = false}) async {
class HackiApp extends StatelessWidget {
const HackiApp({
super.key,
this.savedThemeMode,
required this.trueDarkMode,
required this.font,
super.key,
this.savedThemeMode,
});
final AdaptiveThemeMode? savedThemeMode;
@ -285,8 +280,9 @@ class HackiApp extends StatelessWidget {
final bool useTrueDark = prefState.trueDarkEnabled &&
(mode == AdaptiveThemeMode.dark ||
(mode == AdaptiveThemeMode.system &&
SchedulerBinding
.instance.window.platformBrightness ==
View.of(context)
.platformDispatcher
.platformBrightness ==
Brightness.dark));
return FeatureDiscovery(
child: MaterialApp(

View File

@ -1,10 +1,28 @@
enum Font {
roboto('Roboto'),
robotoSlab('Roboto Slab'),
robotoSlab('Roboto Slab', isSerif: true),
ubuntu('Ubuntu'),
ubuntuMono('Ubuntu Mono');
ubuntuMono('Ubuntu Mono'),
notoSerif('Noto Serif', isSerif: true);
const Font(this.label);
const Font(this.uiLabel, {this.isSerif = false});
final String label;
final String uiLabel;
final bool isSerif;
static Font fromString(String? val) {
switch (val) {
case 'robotoSlab':
return Font.robotoSlab;
case 'ubuntu':
return Font.ubuntu;
case 'ubuntuMono':
return Font.ubuntuMono;
case 'notoSerif':
return Font.notoSerif;
case 'roboto':
default:
return Font.roboto;
}
}
}

View File

@ -35,6 +35,27 @@ class BuildableComment extends Comment with Buildable {
hidden: comment.hidden,
);
@override
BuildableComment copyWith({
int? level,
bool? hidden,
}) {
return BuildableComment(
id: id,
time: time,
parent: parent,
score: score,
by: by,
text: text,
kids: kids,
dead: dead,
deleted: deleted,
hidden: hidden ?? this.hidden,
level: level ?? this.level,
elements: elements,
);
}
@override
final List<LinkifyElement> elements;
}

View File

@ -27,6 +27,8 @@ class Comment extends Item {
String get metadata => '''by $by $timeAgo''';
bool get isRoot => level == 0;
Comment copyWith({
int? level,
bool? hidden,

View File

@ -2,7 +2,6 @@ import 'package:flutter/foundation.dart';
import 'package:hacki/models/models.dart';
import 'package:hacki/services/services.dart';
import 'package:hacki/utils/utils.dart';
import 'package:tuple/tuple.dart';
/// [StoriesRepository] is for fetching
/// [Item] such as [Story], [PollOption], [Comment] or [User].
@ -187,7 +186,7 @@ class StoriesRepository {
/// Fetch the parent [Story] of a [Comment] as well as
/// the list of [Comment] traversed in order to reach the parent.
Future<Tuple2<Story, List<Comment>>?> fetchParentStoryWithComments({
Future<(Story, List<Comment>)?> fetchParentStoryWithComments({
required int id,
}) async {
Item? item;
@ -206,7 +205,7 @@ class StoriesRepository {
parentComments[i].copyWith(level: parentComments.length - i - 1);
}
return Tuple2<Story, List<Comment>>(
return (
item as Story,
parentComments.reversed.toList(),
);

View File

@ -6,8 +6,8 @@ import 'package:hacki/styles/styles.dart';
class MobileHomeScreen extends StatelessWidget {
const MobileHomeScreen({
super.key,
required this.homeScreen,
super.key,
});
final Widget homeScreen;

View File

@ -1,5 +1,4 @@
import 'package:flutter/material.dart' hide Badge;
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_fadein/flutter_fadein.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
@ -7,12 +6,13 @@ import 'package:hacki/cubits/cubits.dart';
import 'package:hacki/models/models.dart';
import 'package:hacki/screens/widgets/widgets.dart';
import 'package:hacki/styles/styles.dart';
import 'package:hacki/utils/utils.dart';
class PinnedStories extends StatelessWidget {
const PinnedStories({
super.key,
required this.preferenceState,
required this.onStoryTapped,
super.key,
});
final PreferenceState preferenceState;
@ -32,7 +32,7 @@ class PinnedStories extends StatelessWidget {
children: <Widget>[
SlidableAction(
onPressed: (_) {
HapticFeedback.lightImpact();
HapticFeedbackUtil.light();
context.read<PinCubit>().unpinStory(story);
},
backgroundColor: Palette.red,

View File

@ -8,8 +8,8 @@ import 'package:responsive_builder/responsive_builder.dart';
class TabletHomeScreen extends StatelessWidget {
const TabletHomeScreen({
super.key,
required this.homeScreen,
super.key,
});
final Widget homeScreen;

View File

@ -2,7 +2,6 @@ import 'package:equatable/equatable.dart';
import 'package:feature_discovery/feature_discovery.dart';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:hacki/blocs/blocs.dart';
import 'package:hacki/config/constants.dart';
@ -15,8 +14,8 @@ import 'package:hacki/screens/item/widgets/widgets.dart';
import 'package:hacki/services/services.dart';
import 'package:hacki/styles/styles.dart';
import 'package:hacki/utils/utils.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:responsive_builder/responsive_builder.dart';
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
class ItemScreenArgs extends Equatable {
const ItemScreenArgs({
@ -46,10 +45,10 @@ class ItemScreenArgs extends Equatable {
class ItemScreen extends StatefulWidget {
const ItemScreen({
super.key,
this.splitViewEnabled = false,
required this.item,
required this.parentComments,
super.key,
this.splitViewEnabled = false,
});
static const String routeName = '/item';
@ -143,12 +142,9 @@ class ItemScreen extends StatefulWidget {
class _ItemScreenState extends State<ItemScreen> with RouteAware {
final TextEditingController commentEditingController =
TextEditingController();
final ScrollController scrollController = ScrollController();
final RefreshController refreshController = RefreshController(
initialLoadStatus: LoadStatus.idle,
initialRefreshStatus: RefreshStatus.refreshing,
);
final FocusNode focusNode = FocusNode();
final ItemScrollController itemScrollController = ItemScrollController();
final ItemPositionsListener itemPositionsListener =
ItemPositionsListener.create();
final Throttle storyLinkTapThrottle = Throttle(
delay: _storyLinkTapThrottleDelay,
);
@ -181,6 +177,8 @@ class _ItemScreenState extends State<ItemScreen> with RouteAware {
Constants.featurePinToTop,
Constants.featureAddStoryToFavList,
Constants.featureOpenStoryInWebView,
Constants.featureJumpUpButton,
Constants.featureJumpDownButton,
},
);
})
@ -194,24 +192,14 @@ class _ItemScreenState extends State<ItemScreen> with RouteAware {
.subscribe(this, route);
});
scrollController.addListener(() {
FocusScope.of(context).requestFocus(FocusNode());
if (commentEditingController.text.isEmpty) {
context.read<EditCubit>().onScrolled();
}
});
commentEditingController.text = context.read<EditCubit>().state.text ?? '';
}
@override
void dispose() {
refreshController.dispose();
commentEditingController.dispose();
scrollController.dispose();
storyLinkTapThrottle.dispose();
featureDiscoveryDismissThrottle.dispose();
focusNode.dispose();
super.dispose();
}
@ -226,166 +214,169 @@ class _ItemScreenState extends State<ItemScreen> with RouteAware {
BlocListener<PostCubit, PostState>(
listener: (BuildContext context, PostState postState) {
if (postState.status == PostStatus.successful) {
Navigator.popUntil(
context,
(Route<dynamic> route) =>
route.settings.name == ItemScreen.routeName,
);
final String verb =
context.read<EditCubit>().state.replyingTo == null
? 'updated'
: 'submitted';
final String msg = 'Comment $verb! ${Constants.happyFace}';
focusNode.unfocus();
HapticFeedback.lightImpact();
HapticFeedbackUtil.light();
showSnackBar(content: msg);
context.read<EditCubit>().onReplySubmittedSuccessfully();
context.read<PostCubit>().reset();
} else if (postState.status == PostStatus.failure) {
Navigator.popUntil(
context,
(Route<dynamic> route) =>
route.settings.name == ItemScreen.routeName,
);
showErrorSnackBar();
context.read<PostCubit>().reset();
}
},
),
],
child: BlocListener<CommentsCubit, CommentsState>(
listenWhen: (CommentsState previous, CommentsState current) =>
previous.status != current.status,
listener: (BuildContext context, CommentsState state) {
if (state.status != CommentsStatus.loading) {
refreshController
..refreshCompleted()
..loadComplete();
child: BlocListener<EditCubit, EditState>(
listenWhen: (EditState previous, EditState current) {
return previous.replyingTo != current.replyingTo ||
previous.itemBeingEdited != current.itemBeingEdited ||
commentEditingController.text != current.text;
},
listener: (BuildContext context, EditState editState) {
if (editState.replyingTo != null ||
editState.itemBeingEdited != null) {
if (editState.text == null) {
commentEditingController.clear();
} else {
final String text = editState.text!;
commentEditingController
..text = text
..selection = TextSelection.fromPosition(
TextPosition(offset: text.length),
);
}
} else {
commentEditingController.clear();
}
},
child: BlocListener<EditCubit, EditState>(
listenWhen: (EditState previous, EditState current) {
return previous.replyingTo != current.replyingTo ||
previous.itemBeingEdited != current.itemBeingEdited ||
commentEditingController.text != current.text;
},
listener: (BuildContext context, EditState editState) {
if (editState.replyingTo != null ||
editState.itemBeingEdited != null) {
if (editState.text == null) {
commentEditingController.clear();
} else {
final String text = editState.text!;
commentEditingController
..text = text
..selection = TextSelection.fromPosition(
TextPosition(offset: text.length),
);
}
} else {
commentEditingController.clear();
}
},
child: widget.splitViewEnabled
? Material(
child: Stack(
children: <Widget>[
Positioned.fill(
child: MainView(
scrollController: scrollController,
refreshController: refreshController,
commentEditingController:
commentEditingController,
authState: authState,
focusNode: focusNode,
topPadding: topPadding,
splitViewEnabled: widget.splitViewEnabled,
onMoreTapped: onMoreTapped,
onRightMoreTapped: onRightMoreTapped,
),
child: widget.splitViewEnabled
? Material(
child: Stack(
children: <Widget>[
Positioned.fill(
child: MainView(
itemScrollController: itemScrollController,
itemPositionsListener: itemPositionsListener,
commentEditingController: commentEditingController,
authState: authState,
topPadding: topPadding,
splitViewEnabled: widget.splitViewEnabled,
onMoreTapped: onMoreTapped,
onRightMoreTapped: onRightMoreTapped,
onReplyTapped: showReplyBox,
),
BlocBuilder<SplitViewCubit, SplitViewState>(
buildWhen: (
SplitViewState previous,
SplitViewState current,
) =>
previous.expanded != current.expanded,
builder: (
BuildContext context,
SplitViewState state,
) {
return Positioned(
top: Dimens.zero,
left: Dimens.zero,
right: Dimens.zero,
child: CustomAppBar(
backgroundColor: Theme.of(context)
.canvasColor
.withOpacity(0.6),
item: widget.item,
scrollController: scrollController,
splitViewEnabled: state.enabled,
expanded: state.expanded,
onZoomTap:
context.read<SplitViewCubit>().zoom,
onFontSizeTap: onFontSizeTapped,
fontSizeIconButtonKey: fontSizeIconButtonKey,
),
);
},
),
BlocBuilder<SplitViewCubit, SplitViewState>(
buildWhen: (
SplitViewState previous,
SplitViewState current,
) =>
previous.expanded != current.expanded,
builder: (
BuildContext context,
SplitViewState state,
) {
return Positioned(
top: Dimens.zero,
left: Dimens.zero,
right: Dimens.zero,
child: CustomAppBar(
backgroundColor: Theme.of(context)
.canvasColor
.withOpacity(0.6),
item: widget.item,
splitViewEnabled: state.enabled,
expanded: state.expanded,
onZoomTap: context.read<SplitViewCubit>().zoom,
onFontSizeTap: onFontSizeTapped,
fontSizeIconButtonKey: fontSizeIconButtonKey,
),
);
},
),
Positioned(
right: Dimens.pt12,
bottom: Dimens.pt36,
child: CustomFloatingActionButton(
itemScrollController: itemScrollController,
itemPositionsListener: itemPositionsListener,
),
Positioned(
bottom: Dimens.zero,
left: Dimens.zero,
right: Dimens.zero,
child: ReplyBox(
splitViewEnabled: true,
focusNode: focusNode,
textEditingController: commentEditingController,
onSendTapped: onSendTapped,
onCloseTapped: () {
context.read<EditCubit>().onReplyBoxClosed();
commentEditingController.clear();
focusNode.unfocus();
},
onChanged:
context.read<EditCubit>().onTextChanged,
),
),
],
),
)
: Scaffold(
extendBodyBehindAppBar: true,
resizeToAvoidBottomInset: true,
appBar: CustomAppBar(
backgroundColor:
Theme.of(context).canvasColor.withOpacity(0.6),
item: widget.item,
scrollController: scrollController,
onFontSizeTap: onFontSizeTapped,
fontSizeIconButtonKey: fontSizeIconButtonKey,
),
body: MainView(
scrollController: scrollController,
refreshController: refreshController,
commentEditingController: commentEditingController,
authState: authState,
focusNode: focusNode,
topPadding: topPadding,
splitViewEnabled: widget.splitViewEnabled,
onMoreTapped: onMoreTapped,
onRightMoreTapped: onRightMoreTapped,
),
bottomSheet: ReplyBox(
focusNode: focusNode,
textEditingController: commentEditingController,
onSendTapped: onSendTapped,
onCloseTapped: () {
context.read<EditCubit>().onReplyBoxClosed();
commentEditingController.clear();
focusNode.unfocus();
},
onChanged: context.read<EditCubit>().onTextChanged,
),
),
],
),
),
)
: Scaffold(
extendBodyBehindAppBar: true,
resizeToAvoidBottomInset: true,
appBar: CustomAppBar(
backgroundColor:
Theme.of(context).canvasColor.withOpacity(0.6),
item: widget.item,
onFontSizeTap: onFontSizeTapped,
fontSizeIconButtonKey: fontSizeIconButtonKey,
),
body: MainView(
itemScrollController: itemScrollController,
itemPositionsListener: itemPositionsListener,
commentEditingController: commentEditingController,
authState: authState,
topPadding: topPadding,
splitViewEnabled: widget.splitViewEnabled,
onMoreTapped: onMoreTapped,
onRightMoreTapped: onRightMoreTapped,
onReplyTapped: showReplyBox,
),
floatingActionButton: CustomFloatingActionButton(
itemScrollController: itemScrollController,
itemPositionsListener: itemPositionsListener,
),
),
),
);
},
);
}
void showReplyBox() {
showModalBottomSheet<void>(
context: context,
isScrollControlled: true,
builder: (BuildContext context) {
return Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
ReplyBox(
textEditingController: commentEditingController,
onSendTapped: onSendTapped,
onCloseTapped: () {
context.read<EditCubit>().onReplyBoxClosed();
commentEditingController.clear();
},
onChanged: context.read<EditCubit>().onTextChanged,
),
SizedBox(
height: MediaQuery.of(context).viewInsets.bottom,
)
],
);
},
);
}
void onFontSizeTapped() {
const Offset offset = Offset.zero;
final RenderBox overlay =
@ -424,7 +415,8 @@ class _ItemScreenState extends State<ItemScreen> with RouteAware {
),
),
onTap: () {
HapticFeedback.lightImpact();
HapticFeedbackUtil.light();
locator.get<AppReviewService>().requestReview();
context.read<PreferenceCubit>().update(
FontSizePreference(),
to: fontSize.index,
@ -436,7 +428,7 @@ class _ItemScreenState extends State<ItemScreen> with RouteAware {
}
void onRightMoreTapped(Comment comment) {
HapticFeedback.lightImpact();
HapticFeedbackUtil.light();
showModalBottomSheet<void>(
context: context,
builder: (BuildContext context) {
@ -462,6 +454,8 @@ class _ItemScreenState extends State<ItemScreen> with RouteAware {
leading: const Icon(Icons.list),
title: const Text('View in separate thread'),
onTap: () {
locator.get<AppReviewService>().requestReview();
Navigator.pop(context);
goToItemScreen(
args: ItemScreenArgs(

View File

@ -1,18 +1,17 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
import 'package:hacki/models/models.dart';
import 'package:hacki/screens/item/widgets/widgets.dart';
import 'package:hacki/styles/styles.dart';
import 'package:hacki/utils/utils.dart';
class CustomAppBar extends AppBar {
CustomAppBar({
super.key,
required ScrollController scrollController,
required Item item,
required Color super.backgroundColor,
required super.backgroundColor,
required VoidCallback onFontSizeTap,
required GlobalKey fontSizeIconButtonKey,
super.key,
bool splitViewEnabled = false,
VoidCallback? onZoomTap,
bool? expanded,
@ -28,15 +27,12 @@ class CustomAppBar extends AppBar {
size: TextDimens.pt20,
),
onPressed: () {
HapticFeedback.lightImpact();
HapticFeedbackUtil.light();
onZoomTap?.call();
},
),
const Spacer(),
],
ScrollUpIconButton(
scrollController: scrollController,
),
IconButton(
key: fontSizeIconButtonKey,
icon: Text(

View File

@ -0,0 +1,99 @@
import 'package:feature_discovery/feature_discovery.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:hacki/config/constants.dart';
import 'package:hacki/cubits/cubits.dart';
import 'package:hacki/screens/widgets/custom_described_feature_overlay.dart';
import 'package:hacki/styles/palette.dart';
import 'package:hacki/utils/utils.dart';
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
class CustomFloatingActionButton extends StatelessWidget {
const CustomFloatingActionButton({
required this.itemScrollController,
required this.itemPositionsListener,
super.key,
});
final ItemScrollController itemScrollController;
final ItemPositionsListener itemPositionsListener;
@override
Widget build(BuildContext context) {
return BlocBuilder<CommentsCubit, CommentsState>(
builder: (BuildContext context, CommentsState state) {
return Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
CustomDescribedFeatureOverlay(
featureId: Constants.featureJumpUpButton,
contentLocation: ContentLocation.above,
tapTarget: const Icon(
Icons.keyboard_arrow_up,
color: Palette.white,
),
title: const Text('Jump to previous root level comment.'),
description: const Text(
'''Tapping on this button will take you to the previous off-screen root level comment.''',
),
child: FloatingActionButton.small(
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
/// Randomly generated string as heroTag to prevent
/// default [FloatingActionButton] animation.
heroTag: UniqueKey().hashCode,
onPressed: () {
if (state.status == CommentsStatus.loading) return;
HapticFeedbackUtil.selection();
context.read<CommentsCubit>().jumpUp(
itemScrollController,
itemPositionsListener,
);
},
child: Icon(
Icons.keyboard_arrow_up,
color: state.status == CommentsStatus.loading
? Palette.grey
: Theme.of(context).colorScheme.primary,
),
),
),
CustomDescribedFeatureOverlay(
featureId: Constants.featureJumpDownButton,
tapTarget: const Icon(
Icons.keyboard_arrow_down,
color: Palette.white,
),
title: const Text('Jump to next root level comment.'),
description: const Text(
'''Tapping on this button will take you to the next off-screen root level comment.''',
),
child: FloatingActionButton.small(
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
/// Same as above.
heroTag: UniqueKey().hashCode,
onPressed: () {
if (state.status == CommentsStatus.loading) return;
HapticFeedbackUtil.selection();
context.read<CommentsCubit>().jump(
itemScrollController,
itemPositionsListener,
);
},
child: Icon(
Icons.keyboard_arrow_down,
color: state.status == CommentsStatus.loading
? Palette.grey
: Theme.of(context).colorScheme.primary,
),
),
),
],
);
},
);
}
}

View File

@ -1,15 +1,15 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:hacki/config/constants.dart';
import 'package:hacki/cubits/cubits.dart';
import 'package:hacki/screens/widgets/widgets.dart';
import 'package:hacki/styles/styles.dart';
import 'package:hacki/utils/utils.dart';
class FavIconButton extends StatelessWidget {
const FavIconButton({
super.key,
required this.storyId,
super.key,
});
final int storyId;
@ -38,7 +38,7 @@ class FavIconButton extends StatelessWidget {
),
),
onPressed: () {
HapticFeedback.lightImpact();
HapticFeedbackUtil.light();
if (isFav) {
context.read<FavCubit>().removeFav(storyId);
} else {

View File

@ -6,8 +6,8 @@ import 'package:hacki/utils/utils.dart';
class LinkIconButton extends StatelessWidget {
const LinkIconButton({
super.key,
required this.storyId,
super.key,
});
final int storyId;

View File

@ -1,5 +1,6 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_fadein/flutter_fadein.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
@ -12,31 +13,31 @@ import 'package:hacki/screens/item/widgets/widgets.dart';
import 'package:hacki/screens/widgets/widgets.dart';
import 'package:hacki/styles/styles.dart';
import 'package:hacki/utils/utils.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
class MainView extends StatelessWidget {
const MainView({
super.key,
required this.scrollController,
required this.refreshController,
required this.itemScrollController,
required this.itemPositionsListener,
required this.commentEditingController,
required this.authState,
required this.focusNode,
required this.topPadding,
required this.splitViewEnabled,
required this.onMoreTapped,
required this.onRightMoreTapped,
required this.onReplyTapped,
super.key,
});
final ScrollController scrollController;
final RefreshController refreshController;
final ItemScrollController itemScrollController;
final ItemPositionsListener itemPositionsListener;
final TextEditingController commentEditingController;
final AuthState authState;
final FocusNode focusNode;
final double topPadding;
final bool splitViewEnabled;
final void Function(Item item, Rect? rect) onMoreTapped;
final ValueChanged<Comment> onRightMoreTapped;
final VoidCallback onReplyTapped;
static const int _loadingIndicatorOpacityAnimationDuration = 300;
static const double _trailingBoxHeight = 240;
@ -48,131 +49,100 @@ class MainView extends StatelessWidget {
Positioned.fill(
child: BlocBuilder<CommentsCubit, CommentsState>(
builder: (BuildContext context, CommentsState state) {
return SmartRefresher(
scrollController: scrollController,
enablePullUp: !state.onlyShowTargetComment,
enablePullDown: !state.onlyShowTargetComment,
header: WaterDropMaterialHeader(
backgroundColor: Palette.orange,
offset: topPadding,
),
footer: CustomFooter(
loadStyle: LoadStyle.ShowWhenLoading,
builder: (BuildContext context, LoadStatus? mode) {
const double height = 55;
late final Widget body;
return Scrollbar(
interactive: true,
child: RefreshIndicator(
displacement: 100,
onRefresh: () async {
HapticFeedbackUtil.light();
if (mode == LoadStatus.idle) {
body = const Text('');
} else if (mode == LoadStatus.loading) {
body = const Text('');
} else if (mode == LoadStatus.failed) {
body = const Text(
'',
);
} else if (mode == LoadStatus.canLoading) {
body = const Text(
'',
);
} else {
body = const Text('');
}
return SizedBox(
height: height,
child: Center(child: body),
);
},
),
controller: refreshController,
onRefresh: () {
HapticFeedback.lightImpact();
if (context.read<StoriesBloc>().state.isOfflineReading ==
false &&
state.onlyShowTargetComment == false) {
unawaited(context.read<CommentsCubit>().refresh());
if (context.read<StoriesBloc>().state.isOfflineReading) {
refreshController.refreshCompleted();
} else {
context.read<CommentsCubit>().refresh();
if (state.item.isPoll) {
context.read<PollCubit>().refresh();
}
}
},
onLoading: () {
if (state.fetchMode == FetchMode.eager) {
context.read<CommentsCubit>().loadMore();
} else {
refreshController.loadComplete();
}
},
child: ListView.builder(
primary: false,
itemCount: state.comments.length + 2,
itemBuilder: (BuildContext context, int index) {
if (index == 0) {
return _ParentItemSection(
scrollController: scrollController,
refreshController: refreshController,
commentEditingController: commentEditingController,
state: state,
authState: authState,
focusNode: focusNode,
topPadding: topPadding,
splitViewEnabled: splitViewEnabled,
onMoreTapped: onMoreTapped,
onRightMoreTapped: onRightMoreTapped,
);
} else if (index == state.comments.length + 1) {
if ((state.status == CommentsStatus.allLoaded &&
state.comments.isNotEmpty) ||
state.onlyShowTargetComment) {
return SizedBox(
height: _trailingBoxHeight,
child: Center(
child: Text(Constants.happyFace),
),
);
} else {
return const SizedBox.shrink();
if (state.item.isPoll) {
context.read<PollCubit>().refresh();
}
}
index = index - 1;
final Comment comment = state.comments.elementAt(index);
return FadeIn(
key: ValueKey<String>('${comment.id}-FadeIn'),
child: CommentTile(
comment: comment,
level: comment.level,
opUsername: state.item.by,
fetchMode: state.fetchMode,
onReplyTapped: (Comment cmt) {
HapticFeedback.lightImpact();
if (cmt.deleted || cmt.dead) {
return;
}
if (cmt.id !=
context.read<EditCubit>().state.replyingTo?.id) {
commentEditingController.clear();
}
context.read<EditCubit>().onReplyTapped(cmt);
focusNode.requestFocus();
},
onEditTapped: (Comment cmt) {
HapticFeedback.lightImpact();
if (cmt.deleted || cmt.dead) {
return;
}
commentEditingController.clear();
context.read<EditCubit>().onEditTapped(cmt);
focusNode.requestFocus();
},
onMoreTapped: onMoreTapped,
onRightMoreTapped: onRightMoreTapped,
),
);
},
child: ScrollablePositionedList.builder(
physics: const AlwaysScrollableScrollPhysics(),
itemScrollController: itemScrollController,
itemPositionsListener: itemPositionsListener,
itemCount: state.comments.length + 2,
padding: EdgeInsets.only(top: topPadding),
itemBuilder: (BuildContext context, int index) {
if (index == 0) {
return _ParentItemSection(
commentEditingController: commentEditingController,
state: state,
authState: authState,
topPadding: topPadding,
splitViewEnabled: splitViewEnabled,
onMoreTapped: onMoreTapped,
onRightMoreTapped: onRightMoreTapped,
onReplyTapped: onReplyTapped,
);
} else if (index == state.comments.length + 1) {
if ((state.status == CommentsStatus.allLoaded &&
state.comments.isNotEmpty) ||
state.onlyShowTargetComment) {
return SizedBox(
height: _trailingBoxHeight,
child: Center(
child: Text(Constants.happyFace),
),
);
} else {
return const SizedBox.shrink();
}
}
index = index - 1;
final Comment comment = state.comments.elementAt(index);
return FadeIn(
key: ValueKey<String>('${comment.id}-FadeIn'),
child: CommentTile(
comment: comment,
level: comment.level,
opUsername: state.item.by,
fetchMode: state.fetchMode,
onReplyTapped: (Comment cmt) {
HapticFeedbackUtil.light();
if (cmt.deleted || cmt.dead) {
return;
}
if (cmt.id !=
context
.read<EditCubit>()
.state
.replyingTo
?.id) {
commentEditingController.clear();
}
context.read<EditCubit>().onReplyTapped(cmt);
onReplyTapped();
},
onEditTapped: (Comment cmt) {
HapticFeedbackUtil.light();
if (cmt.deleted || cmt.dead) {
return;
}
commentEditingController.clear();
context.read<EditCubit>().onEditTapped(cmt);
onReplyTapped();
},
onMoreTapped: onMoreTapped,
onRightMoreTapped: onRightMoreTapped,
),
);
},
),
),
);
},
@ -198,7 +168,7 @@ class MainView extends StatelessWidget {
);
},
),
)
),
],
);
}
@ -206,28 +176,27 @@ class MainView extends StatelessWidget {
class _ParentItemSection extends StatelessWidget {
const _ParentItemSection({
required this.scrollController,
required this.refreshController,
required this.commentEditingController,
required this.state,
required this.authState,
required this.focusNode,
required this.topPadding,
required this.splitViewEnabled,
required this.onMoreTapped,
required this.onRightMoreTapped,
required this.onReplyTapped,
});
final ScrollController scrollController;
final RefreshController refreshController;
final TextEditingController commentEditingController;
final CommentsState state;
final AuthState authState;
final FocusNode focusNode;
final double topPadding;
final bool splitViewEnabled;
final void Function(Item item, Rect? rect) onMoreTapped;
final ValueChanged<Comment> onRightMoreTapped;
final VoidCallback onReplyTapped;
static const double _viewParentButtonWidth = 100;
static const double _viewRootButtonWidth = 80;
@override
Widget build(BuildContext context) {
@ -236,168 +205,170 @@ class _ParentItemSection extends StatelessWidget {
'''Posted by ${state.item.by} ${state.item.timeAgo}, ${state.item.title}. ${state.item.text}''',
child: Column(
children: <Widget>[
SizedBox(
height: topPadding,
),
if (!splitViewEnabled)
const Padding(
padding: EdgeInsets.only(bottom: Dimens.pt6),
child: OfflineBanner(),
),
Slidable(
startActionPane: ActionPane(
motion: const BehindMotion(),
children: <Widget>[
SlidableAction(
onPressed: (_) {
HapticFeedback.lightImpact();
DeviceGestureWrapper(
child: Slidable(
startActionPane: ActionPane(
motion: const BehindMotion(),
children: <Widget>[
SlidableAction(
onPressed: (_) {
HapticFeedbackUtil.light();
if (state.item.id !=
context.read<EditCubit>().state.replyingTo?.id) {
commentEditingController.clear();
}
context.read<EditCubit>().onReplyTapped(state.item);
focusNode.requestFocus();
},
backgroundColor: Palette.orange,
foregroundColor: Palette.white,
icon: Icons.message,
),
SlidableAction(
onPressed: (BuildContext context) =>
onMoreTapped(state.item, context.rect),
backgroundColor: Palette.orange,
foregroundColor: Palette.white,
icon: Icons.more_horiz,
),
],
),
child: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(
left: Dimens.pt6,
right: Dimens.pt6,
if (state.item.id !=
context.read<EditCubit>().state.replyingTo?.id) {
commentEditingController.clear();
}
context.read<EditCubit>().onReplyTapped(state.item);
onReplyTapped();
},
backgroundColor: Palette.orange,
foregroundColor: Palette.white,
icon: Icons.message,
),
child: Row(
children: <Widget>[
Text(
state.item.by,
style: const TextStyle(
color: Palette.orange,
),
),
const Spacer(),
Text(
state.item.timeAgo,
style: const TextStyle(
color: Palette.grey,
),
),
],
SlidableAction(
onPressed: (BuildContext context) =>
onMoreTapped(state.item, context.rect),
backgroundColor: Palette.orange,
foregroundColor: Palette.white,
icon: Icons.more_horiz,
),
),
BlocBuilder<PreferenceCubit, PreferenceState>(
buildWhen: (
PreferenceState previous,
PreferenceState current,
) =>
previous.fontSize != current.fontSize,
builder: (
BuildContext context,
PreferenceState prefState,
) {
return Column(
],
),
child: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(
left: Dimens.pt6,
right: Dimens.pt6,
),
child: Row(
children: <Widget>[
if (state.item is Story)
InkWell(
onTap: () => LinkUtil.launch(
state.item.url,
useReader: context
.read<PreferenceCubit>()
.state
.readerEnabled,
offlineReading: context
.read<StoriesBloc>()
.state
.isOfflineReading,
),
child: Padding(
padding: const EdgeInsets.only(
left: Dimens.pt6,
right: Dimens.pt6,
bottom: Dimens.pt12,
top: Dimens.pt12,
Text(
state.item.by,
style: const TextStyle(
color: Palette.orange,
),
),
const Spacer(),
Text(
state.item.timeAgo,
style: const TextStyle(
color: Palette.grey,
),
),
],
),
),
BlocBuilder<PreferenceCubit, PreferenceState>(
buildWhen: (
PreferenceState previous,
PreferenceState current,
) =>
previous.fontSize != current.fontSize,
builder: (
BuildContext context,
PreferenceState prefState,
) {
return Column(
children: <Widget>[
if (state.item is Story)
InkWell(
onTap: () => LinkUtil.launch(
state.item.url,
useReader: context
.read<PreferenceCubit>()
.state
.readerEnabled,
offlineReading: context
.read<StoriesBloc>()
.state
.isOfflineReading,
),
child: Text.rich(
TextSpan(
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: prefState.fontSize.fontSize,
color: Theme.of(context)
.textTheme
.bodyLarge
?.color,
),
children: <TextSpan>[
TextSpan(
semanticsLabel: state.item.title,
text: state.item.title,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: prefState.fontSize.fontSize,
color: state.item.url.isNotEmpty
? Palette.orange
: null,
),
child: Padding(
padding: const EdgeInsets.only(
left: Dimens.pt6,
right: Dimens.pt6,
bottom: Dimens.pt12,
top: Dimens.pt12,
),
child: Text.rich(
TextSpan(
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: prefState.fontSize.fontSize,
color: Theme.of(context)
.textTheme
.bodyLarge
?.color,
),
if (state.item.url.isNotEmpty)
children: <TextSpan>[
TextSpan(
text:
''' (${(state.item as Story).readableUrl})''',
semanticsLabel: state.item.title,
text: state.item.title,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize:
prefState.fontSize.fontSize - 4,
color: Palette.orange,
fontSize: prefState.fontSize.fontSize,
color: state.item.url.isNotEmpty
? Palette.orange
: null,
),
),
],
if (state.item.url.isNotEmpty)
TextSpan(
text:
''' (${(state.item as Story).readableUrl})''',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize:
prefState.fontSize.fontSize - 4,
color: Palette.orange,
),
),
],
),
textAlign: TextAlign.center,
textScaleFactor: MediaQuery.of(
context,
).textScaleFactor,
),
),
)
else
const SizedBox(
height: Dimens.pt6,
),
if (state.item.text.isNotEmpty)
FadeIn(
child: SizedBox(
width: double.infinity,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: Dimens.pt10,
),
child: ItemText(
item: state.item,
),
),
textAlign: TextAlign.center,
textScaleFactor: MediaQuery.of(
context,
).textScaleFactor,
),
),
)
else
const SizedBox(
height: Dimens.pt6,
),
if (state.item.text.isNotEmpty)
SizedBox(
width: double.infinity,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: Dimens.pt10,
),
child: ItemText(
item: state.item,
),
),
),
],
);
},
),
if (state.item.isPoll)
BlocProvider<PollCubit>(
create: (BuildContext context) =>
PollCubit(story: state.item as Story)..init(),
child: const PollView(),
],
);
},
),
],
if (state.item.isPoll)
BlocProvider<PollCubit>(
create: (BuildContext context) =>
PollCubit(story: state.item as Story)..init(),
child: const PollView(),
),
],
),
),
),
if (state.item.text.isNotEmpty)
@ -435,22 +406,45 @@ class _ParentItemSection extends StatelessWidget {
const SizedBox(
width: Dimens.pt4,
),
TextButton(
onPressed: context.read<CommentsCubit>().loadParentThread,
child: state.fetchParentStatus == CommentsStatus.loading
? const SizedBox(
height: Dimens.pt12,
width: Dimens.pt12,
child: CustomCircularProgressIndicator(
strokeWidth: Dimens.pt2,
SizedBox(
width: _viewParentButtonWidth,
child: TextButton(
onPressed: context.read<CommentsCubit>().loadParentThread,
child: state.fetchParentStatus == CommentsStatus.loading
? const SizedBox(
height: Dimens.pt12,
width: Dimens.pt12,
child: CustomCircularProgressIndicator(
strokeWidth: Dimens.pt2,
),
)
: const Text(
'View parent',
style: TextStyle(
fontSize: TextDimens.pt13,
),
),
)
: const Text(
'View parent thread',
style: TextStyle(
fontSize: TextDimens.pt13,
),
),
SizedBox(
width: _viewRootButtonWidth,
child: TextButton(
onPressed: context.read<CommentsCubit>().loadRootThread,
child: state.fetchRootStatus == CommentsStatus.loading
? const SizedBox(
height: Dimens.pt12,
width: Dimens.pt12,
child: CustomCircularProgressIndicator(
strokeWidth: Dimens.pt2,
),
)
: const Text(
'View root',
style: TextStyle(
fontSize: TextDimens.pt13,
),
),
),
),
),
],
const Spacer(),

View File

@ -2,21 +2,23 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
import 'package:hacki/blocs/blocs.dart';
import 'package:hacki/config/locator.dart';
import 'package:hacki/cubits/cubits.dart';
import 'package:hacki/extensions/extensions.dart';
import 'package:hacki/models/models.dart';
import 'package:hacki/screens/item/models/models.dart';
import 'package:hacki/screens/screens.dart';
import 'package:hacki/screens/widgets/widgets.dart';
import 'package:hacki/services/services.dart';
import 'package:hacki/styles/styles.dart';
import 'package:hacki/utils/utils.dart';
class MorePopupMenu extends StatelessWidget {
const MorePopupMenu({
super.key,
required this.item,
required this.isBlocked,
required this.onLoginTapped,
super.key,
});
final Item item;
@ -99,10 +101,10 @@ class MorePopupMenu extends StatelessWidget {
'About ${state.user.id}',
),
content: state.user.about.isEmpty
? Row(
? const Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
Text(
'empty',
style: TextStyle(
@ -125,6 +127,9 @@ class MorePopupMenu extends StatelessWidget {
actions: <Widget>[
TextButton(
onPressed: () {
locator
.get<AppReviewService>()
.requestReview();
Navigator.pop(context);
onSearchUserTapped(context);
},
@ -133,7 +138,12 @@ class MorePopupMenu extends StatelessWidget {
),
),
TextButton(
onPressed: () => Navigator.pop(context),
onPressed: () {
locator
.get<AppReviewService>()
.requestReview();
Navigator.pop(context);
},
child: const Text(
'Okay',
),

View File

@ -1,18 +1,18 @@
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:hacki/config/constants.dart';
import 'package:hacki/cubits/cubits.dart';
import 'package:hacki/models/models.dart';
import 'package:hacki/screens/widgets/widgets.dart';
import 'package:hacki/styles/styles.dart';
import 'package:hacki/utils/utils.dart';
class PinIconButton extends StatelessWidget {
const PinIconButton({
super.key,
required this.story,
super.key,
});
final Story story;
@ -49,7 +49,7 @@ class PinIconButton extends StatelessWidget {
),
),
onPressed: () {
HapticFeedback.lightImpact();
HapticFeedbackUtil.light();
if (pinned) {
context.read<PinCubit>().unpinStory(story);
} else {

View File

@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_fadein/flutter_fadein.dart';
import 'package:hacki/blocs/auth/auth_bloc.dart';
@ -7,6 +6,7 @@ import 'package:hacki/cubits/cubits.dart';
import 'package:hacki/extensions/extensions.dart';
import 'package:hacki/models/models.dart';
import 'package:hacki/styles/styles.dart';
import 'package:hacki/utils/utils.dart';
class PollView extends StatefulWidget {
const PollView({super.key});
@ -100,7 +100,7 @@ class _PollViewState extends State<PollView> {
children: <Widget>[
IconButton(
onPressed: () {
HapticFeedback.lightImpact();
HapticFeedbackUtil.light();
context.read<VoteCubit>().upvote();
},
icon: Icon(

View File

@ -1,6 +1,5 @@
import 'package:clipboard/clipboard.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
import 'package:hacki/cubits/cubits.dart';
@ -9,20 +8,19 @@ import 'package:hacki/models/item/item.dart';
import 'package:hacki/screens/screens.dart';
import 'package:hacki/screens/widgets/widgets.dart';
import 'package:hacki/styles/styles.dart';
import 'package:hacki/utils/utils.dart';
class ReplyBox extends StatefulWidget {
const ReplyBox({
super.key,
this.splitViewEnabled = false,
required this.focusNode,
required this.textEditingController,
required this.onSendTapped,
required this.onCloseTapped,
required this.onChanged,
super.key,
this.splitViewEnabled = false,
});
final bool splitViewEnabled;
final FocusNode focusNode;
final TextEditingController textEditingController;
final VoidCallback onSendTapped;
final VoidCallback onCloseTapped;
@ -47,206 +45,203 @@ class _ReplyBoxState extends State<ReplyBox> {
previous.itemBeingEdited != current.itemBeingEdited ||
previous.replyingTo != current.replyingTo,
builder: (BuildContext context, EditState editState) {
return Visibility(
visible: editState.showReplyBox,
child: BlocBuilder<PostCubit, PostState>(
builder: (BuildContext context, PostState postState) {
final Item? replyingTo = editState.replyingTo;
final bool isLoading = postState.status == PostStatus.loading;
return BlocBuilder<PostCubit, PostState>(
builder: (BuildContext context, PostState postState) {
final Item? replyingTo = editState.replyingTo;
final bool isLoading = postState.status == PostStatus.loading;
return Padding(
padding: EdgeInsets.only(
bottom: expanded
? Dimens.zero
: widget.splitViewEnabled
? MediaQuery.of(context).viewInsets.bottom
: Dimens.zero,
return Padding(
padding: EdgeInsets.only(
bottom: expanded
? Dimens.zero
: widget.splitViewEnabled
? MediaQuery.of(context).viewInsets.bottom
: Dimens.zero,
),
child: AnimatedContainer(
height: expanded ? expandedHeight : _collapsedHeight,
duration: const Duration(milliseconds: 200),
decoration: BoxDecoration(
boxShadow: <BoxShadow>[
if (!context.read<SplitViewCubit>().state.enabled)
BoxShadow(
color: expanded ? Palette.transparent : Palette.black26,
blurRadius: Dimens.pt40,
),
],
),
child: AnimatedContainer(
height: expanded ? expandedHeight : _collapsedHeight,
duration: const Duration(milliseconds: 200),
decoration: BoxDecoration(
boxShadow: <BoxShadow>[
if (!context.read<SplitViewCubit>().state.enabled)
BoxShadow(
color:
expanded ? Palette.transparent : Palette.black26,
blurRadius: Dimens.pt40,
child: Material(
child: Column(
children: <Widget>[
if (context.read<SplitViewCubit>().state.enabled)
const Divider(
height: Dimens.zero,
),
],
),
child: Material(
child: Column(
children: <Widget>[
if (context.read<SplitViewCubit>().state.enabled)
const Divider(
height: Dimens.zero,
),
AnimatedContainer(
height: expanded ? Dimens.pt36 : Dimens.zero,
duration: const Duration(milliseconds: 200),
),
Row(
children: <Widget>[
Expanded(
child: Padding(
padding: const EdgeInsets.only(
left: Dimens.pt12,
top: Dimens.pt8,
bottom: Dimens.pt8,
),
child: Text(
replyingTo == null
? 'Editing'
: 'Replying '
'${replyingTo.by}',
style: const TextStyle(color: Palette.grey),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
AnimatedContainer(
height: expanded ? Dimens.pt36 : Dimens.zero,
duration: const Duration(milliseconds: 200),
),
Row(
children: <Widget>[
Expanded(
child: Padding(
padding: const EdgeInsets.only(
left: Dimens.pt12,
top: Dimens.pt8,
bottom: Dimens.pt8,
),
child: Text(
replyingTo == null
? 'Editing'
: 'Replying to '
'${replyingTo.by}',
style: const TextStyle(color: Palette.grey),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
if (!isLoading) ...<Widget>[
...<Widget>[
if (replyingTo != null)
AnimatedOpacity(
opacity:
expanded ? NumSwitch.on : NumSwitch.off,
duration: const Duration(milliseconds: 300),
child: IconButton(
key: const Key('quote'),
icon: const Icon(
FeatherIcons.code,
color: Palette.orange,
size: TextDimens.pt18,
),
onPressed:
expanded ? showTextPopup : null,
),
if (!isLoading) ...<Widget>[
...<Widget>[
if (replyingTo != null)
AnimatedOpacity(
opacity:
expanded ? NumSwitch.on : NumSwitch.off,
duration: const Duration(milliseconds: 300),
child: IconButton(
key: const Key('quote'),
icon: const Icon(
FeatherIcons.code,
color: Palette.orange,
size: TextDimens.pt18,
),
onPressed: expanded ? showTextPopup : null,
),
IconButton(
key: const Key('expand'),
icon: Icon(
expanded
? FeatherIcons.minimize2
: FeatherIcons.maximize2,
color: Palette.orange,
size: TextDimens.pt18,
),
onPressed: () {
setState(() {
expanded = !expanded;
});
},
),
],
IconButton(
key: const Key('close'),
icon: const Icon(
Icons.close,
key: const Key('expand'),
icon: Icon(
expanded
? FeatherIcons.minimize2
: FeatherIcons.maximize2,
color: Palette.orange,
size: TextDimens.pt18,
),
onPressed: () {
final EditState state =
context.read<EditCubit>().state;
if (state.replyingTo != null &&
state.text.isNotNullOrEmpty) {
showDialog<void>(
context: context,
builder: (BuildContext context) =>
AlertDialog(
title: const Text('Save draft?'),
actions: <Widget>[
TextButton(
onPressed: () {
context
.read<EditCubit>()
.deleteDraft();
Navigator.pop(context);
},
child: const Text(
'No',
style: TextStyle(
color: Palette.red,
),
),
),
TextButton(
onPressed: () =>
Navigator.pop(context),
child: const Text('Yes'),
),
],
),
);
}
widget.onCloseTapped();
expanded = false;
setState(() {
expanded = !expanded;
});
},
),
],
if (isLoading)
const Padding(
padding: EdgeInsets.symmetric(
vertical: Dimens.pt12,
horizontal: Dimens.pt16,
),
child: SizedBox(
height: Dimens.pt24,
width: Dimens.pt24,
child: CircularProgressIndicator(
color: Palette.orange,
strokeWidth: Dimens.pt2,
),
),
)
else
IconButton(
key: const Key('send'),
icon: const Icon(
Icons.send,
color: Palette.orange,
),
onPressed: () {
widget.onSendTapped();
expanded = false;
},
IconButton(
key: const Key('close'),
icon: const Icon(
Icons.close,
color: Palette.orange,
),
onPressed: () {
Navigator.pop(context);
final EditState state =
context.read<EditCubit>().state;
if (state.replyingTo != null &&
state.text.isNotNullOrEmpty) {
showDialog<void>(
context: context,
builder: (BuildContext context) =>
AlertDialog(
title: const Text('Save draft?'),
actions: <Widget>[
TextButton(
onPressed: () {
context
.read<EditCubit>()
.deleteDraft();
Navigator.pop(context);
},
child: const Text(
'No',
style: TextStyle(
color: Palette.red,
),
),
),
TextButton(
onPressed: () =>
Navigator.pop(context),
child: const Text('Yes'),
),
],
),
);
}
widget.onCloseTapped();
expanded = false;
},
),
],
),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: Dimens.pt16,
),
child: TextField(
focusNode: widget.focusNode,
controller: widget.textEditingController,
maxLines: 100,
decoration: const InputDecoration(
alignLabelWithHint: true,
contentPadding: EdgeInsets.zero,
hintText: '...',
hintStyle: TextStyle(
color: Palette.grey,
),
focusedBorder: InputBorder.none,
border: InputBorder.none,
if (isLoading)
const Padding(
padding: EdgeInsets.symmetric(
vertical: Dimens.pt12,
horizontal: Dimens.pt16,
),
keyboardType: TextInputType.multiline,
textCapitalization: TextCapitalization.sentences,
textInputAction: TextInputAction.newline,
onChanged: widget.onChanged,
child: SizedBox(
height: Dimens.pt24,
width: Dimens.pt24,
child: CircularProgressIndicator(
color: Palette.orange,
strokeWidth: Dimens.pt2,
),
),
)
else
IconButton(
key: const Key('send'),
icon: const Icon(
Icons.send,
color: Palette.orange,
),
onPressed: () {
widget.onSendTapped();
expanded = false;
},
),
],
),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: Dimens.pt16,
),
child: TextField(
autofocus: true,
controller: widget.textEditingController,
maxLines: 100,
decoration: const InputDecoration(
alignLabelWithHint: true,
contentPadding: EdgeInsets.zero,
hintText: '...',
hintStyle: TextStyle(
color: Palette.grey,
),
focusedBorder: InputBorder.none,
border: InputBorder.none,
),
keyboardType: TextInputType.multiline,
textCapitalization: TextCapitalization.sentences,
textInputAction: TextInputAction.newline,
onChanged: widget.onChanged,
),
),
],
),
),
],
),
),
);
},
),
),
);
},
);
},
);
@ -296,7 +291,7 @@ class _ReplyBoxState extends State<ReplyBox> {
),
),
onPressed: () {
HapticFeedback.lightImpact();
HapticFeedbackUtil.light();
setState(() {
expanded = false;
});
@ -324,7 +319,7 @@ class _ReplyBoxState extends State<ReplyBox> {
),
onPressed: () => FlutterClipboard.copy(
replyingTo.text,
).then((_) => HapticFeedback.selectionClick()),
).then((_) => HapticFeedbackUtil.selection()),
),
IconButton(
icon: const Icon(

View File

@ -1,59 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
import 'package:hacki/styles/styles.dart';
class ScrollUpIconButton extends StatefulWidget {
const ScrollUpIconButton({
super.key,
required this.scrollController,
});
final ScrollController scrollController;
@override
_ScrollUpIconButtonState createState() => _ScrollUpIconButtonState();
}
class _ScrollUpIconButtonState extends State<ScrollUpIconButton> {
@override
void initState() {
super.initState();
widget.scrollController.addListener(() {
if (widget.scrollController.offset <= 1000 && mounted) {
setState(() {});
}
});
}
@override
Widget build(BuildContext context) {
if (widget.scrollController.hasClients) {
final double curPos = widget.scrollController.offset;
final double opacity = curPos / 1000;
return Opacity(
opacity: opacity.clamp(0, 1),
child: IconButton(
tooltip: 'Scroll to top',
icon: const Icon(
FeatherIcons.chevronsUp,
color: Palette.orange,
size: TextDimens.pt26,
),
onPressed: () {
final double curPos = widget.scrollController.offset;
widget.scrollController.animateTo(
0,
curve: Curves.bounceOut,
duration: Duration(
milliseconds: curPos ~/ 15,
),
);
},
),
);
}
return Container();
}
}

View File

@ -8,11 +8,11 @@ import 'package:responsive_builder/responsive_builder.dart';
class TimeMachineDialog extends StatelessWidget {
const TimeMachineDialog({
super.key,
required this.comment,
required this.size,
required this.deviceType,
required this.widthFactor,
super.key,
});
final Comment comment;

View File

@ -1,4 +1,5 @@
export 'custom_app_bar.dart';
export 'custom_floating_action_button.dart';
export 'fav_icon_button.dart';
export 'link_icon_button.dart';
export 'login_dialog.dart';
@ -7,5 +8,4 @@ export 'more_popup_menu.dart';
export 'pin_icon_button.dart';
export 'poll_view.dart';
export 'reply_box.dart';
export 'scroll_up_icon_button.dart';
export 'time_machine_dialog.dart';

View File

@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:hacki/blocs/blocs.dart';
import 'package:hacki/config/constants.dart';
@ -16,7 +15,6 @@ import 'package:hacki/screens/widgets/widgets.dart';
import 'package:hacki/styles/styles.dart';
import 'package:hacki/utils/utils.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:tuple/tuple.dart';
class ProfileScreen extends StatefulWidget {
const ProfileScreen({super.key});
@ -102,7 +100,7 @@ class _ProfileScreenState extends State<ProfileScreen>
.where((Item e) => !e.dead && !e.deleted)
.toList(),
onRefresh: () {
HapticFeedback.lightImpact();
HapticFeedbackUtil.light();
context.read<HistoryCubit>().refresh();
},
onLoadMore: () {
@ -166,7 +164,7 @@ class _ProfileScreenState extends State<ProfileScreen>
refreshController: refreshControllerFav,
items: favState.favItems,
onRefresh: () {
HapticFeedback.lightImpact();
HapticFeedbackUtil.light();
context.read<FavCubit>().refresh();
},
onLoadMore: () {
@ -221,7 +219,7 @@ class _ProfileScreenState extends State<ProfileScreen>
context.read<NotificationCubit>().loadMore();
},
onRefresh: () {
HapticFeedback.lightImpact();
HapticFeedbackUtil.light();
context.read<NotificationCubit>().refresh();
},
),
@ -354,16 +352,18 @@ class _ProfileScreenState extends State<ProfileScreen>
locator
.get<StoriesRepository>()
.fetchParentStoryWithComments(id: comment.parent)
.then((Tuple2<Story, List<Comment>>? tuple) {
if (tuple != null && mounted) {
.then(((Story, List<Comment>)? res) {
if (res != null && mounted) {
final Story parent = res.$1;
final List<Comment> children = res.$2;
goToItemScreen(
args: ItemScreenArgs(
item: tuple.item1,
targetComments: tuple.item2.isEmpty
item: parent,
targetComments: children.isEmpty
? <Comment>[comment]
: <Comment>[
...tuple.item2,
comment.copyWith(level: tuple.item2.length)
...children,
comment.copyWith(level: children.length)
],
onlyShowTargetComment: true,
),

View File

@ -3,8 +3,8 @@ import 'package:hacki/styles/styles.dart';
class CenteredMessageView extends StatelessWidget {
const CenteredMessageView({
super.key,
required this.content,
super.key,
});
final String content;

View File

@ -8,7 +8,6 @@ import 'package:pull_to_refresh/pull_to_refresh.dart';
class InboxView extends StatelessWidget {
const InboxView({
super.key,
required this.refreshController,
required this.comments,
required this.unreadCommentsIds,
@ -16,6 +15,7 @@ class InboxView extends StatelessWidget {
required this.onMarkAllAsReadTapped,
required this.onLoadMore,
required this.onRefresh,
super.key,
});
final RefreshController refreshController;

View File

@ -3,7 +3,6 @@ import 'dart:io';
import 'package:adaptive_theme/adaptive_theme.dart';
import 'package:clipboard/clipboard.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:flutter_email_sender/flutter_email_sender.dart';
@ -28,10 +27,10 @@ import 'package:share_plus/share_plus.dart';
class Settings extends StatefulWidget {
const Settings({
super.key,
required this.authState,
required this.magicWord,
required this.pageType,
super.key,
});
final AuthState authState;
@ -75,13 +74,13 @@ class _SettingsState extends State<Settings> {
const SizedBox(
height: Dimens.pt8,
),
Flex(
const Flex(
direction: Axis.horizontal,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Flexible(
child: Row(
children: const <Widget>[
children: <Widget>[
SizedBox(
width: Dimens.pt16,
),
@ -92,7 +91,7 @@ class _SettingsState extends State<Settings> {
),
Flexible(
child: Row(
children: const <Widget>[
children: <Widget>[
Text('Default comments order'),
Spacer(),
],
@ -129,7 +128,7 @@ class _SettingsState extends State<Settings> {
.toList(),
onChanged: (FetchMode? fetchMode) {
if (fetchMode != null) {
HapticFeedback.selectionClick();
HapticFeedbackUtil.selection();
context.read<PreferenceCubit>().update(
FetchModePreference(),
to: fetchMode.index,
@ -163,7 +162,7 @@ class _SettingsState extends State<Settings> {
.toList(),
onChanged: (CommentsOrder? order) {
if (order != null) {
HapticFeedback.selectionClick();
HapticFeedbackUtil.selection();
context.read<PreferenceCubit>().update(
CommentsOrderPreference(),
to: order.index,
@ -202,7 +201,7 @@ class _SettingsState extends State<Settings> {
preference as BooleanPreference,
),
onChanged: (bool val) {
HapticFeedback.lightImpact();
HapticFeedbackUtil.light();
context
.read<PreferenceCubit>()
@ -335,12 +334,12 @@ class _SettingsState extends State<Settings> {
}
},
title: Text(
font.label,
font.uiLabel,
style: TextStyle(fontFamily: font.name),
),
),
Row(
children: const <Widget>[
const Row(
children: <Widget>[
Text(
'*Restart required',
style: TextStyle(
@ -398,14 +397,11 @@ class _SettingsState extends State<Settings> {
switch (val) {
case AdaptiveThemeMode.light:
AdaptiveTheme.of(context).setLight();
break;
case AdaptiveThemeMode.dark:
AdaptiveTheme.of(context).setDark();
break;
case AdaptiveThemeMode.system:
case null:
AdaptiveTheme.of(context).setSystem();
break;
}
final Brightness brightness = Theme.of(context).brightness;
@ -486,8 +482,8 @@ class _SettingsState extends State<Settings> {
onPressed: () => LinkUtil.launch(
Constants.portfolioLink,
),
child: Row(
children: const <Widget>[
child: const Row(
children: <Widget>[
Icon(
FontAwesomeIcons.addressCard,
),
@ -502,8 +498,8 @@ class _SettingsState extends State<Settings> {
onPressed: () => LinkUtil.launch(
Constants.privacyPolicyLink,
),
child: Row(
children: const <Widget>[
child: const Row(
children: <Widget>[
Icon(
Icons.privacy_tip_outlined,
),
@ -516,8 +512,8 @@ class _SettingsState extends State<Settings> {
),
ElevatedButton(
onPressed: onReportIssueTapped,
child: Row(
children: const <Widget>[
child: const Row(
children: <Widget>[
Icon(
Icons.bug_report_outlined,
),
@ -532,8 +528,8 @@ class _SettingsState extends State<Settings> {
onPressed: () => LinkUtil.launch(
Constants.githubLink,
),
child: Row(
children: const <Widget>[
child: const Row(
children: <Widget>[
Icon(
FontAwesomeIcons.github,
),
@ -550,8 +546,8 @@ class _SettingsState extends State<Settings> {
? Constants.appStoreLink
: Constants.googlePlayLink,
),
child: Row(
children: const <Widget>[
child: const Row(
children: <Widget>[
Icon(
Icons.thumb_up,
),
@ -566,8 +562,8 @@ class _SettingsState extends State<Settings> {
onPressed: () => LinkUtil.launch(
Constants.sponsorLink,
),
child: Row(
children: const <Widget>[
child: const Row(
children: <Widget>[
Icon(
FeatherIcons.coffee,
),
@ -591,8 +587,8 @@ class _SettingsState extends State<Settings> {
actions: <Widget>[
ElevatedButton(
onPressed: onSendEmailTapped,
child: Row(
children: const <Widget>[
child: const Row(
children: <Widget>[
Icon(
Icons.email,
),
@ -605,8 +601,8 @@ class _SettingsState extends State<Settings> {
),
ElevatedButton(
onPressed: () => onGithubTapped(context.rect),
child: Row(
children: const <Widget>[
child: const Row(
children: <Widget>[
Icon(
Icons.bug_report_outlined,
),
@ -766,7 +762,7 @@ class _SettingsState extends State<Settings> {
try {
await FlutterClipboard.copy(
allFavorites.join('\n'),
).whenComplete(HapticFeedback.selectionClick);
).whenComplete(HapticFeedbackUtil.selection);
showSnackBar(content: 'Ids of favorites have been copied to clipboard.');
} catch (error, stackTrace) {
error.logError(stackTrace: stackTrace);

View File

@ -1,9 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:hacki/cubits/cubits.dart';
import 'package:hacki/models/models.dart';
import 'package:hacki/styles/styles.dart';
import 'package:hacki/utils/utils.dart';
class TabBarSettings extends StatefulWidget {
const TabBarSettings({super.key});
@ -20,8 +20,8 @@ class _TabBarSettingsState extends State<TabBarSettings> {
Widget build(BuildContext context) {
return Column(
children: <Widget>[
Row(
children: const <Widget>[
const Row(
children: <Widget>[
SizedBox(
width: Dimens.pt16,
),
@ -39,7 +39,7 @@ class _TabBarSettingsState extends State<TabBarSettings> {
scrollDirection: Axis.horizontal,
physics: const NeverScrollableScrollPhysics(),
onReorder: context.read<TabCubit>().update,
onReorderStart: (_) => HapticFeedback.lightImpact(),
onReorderStart: (_) => HapticFeedbackUtil.light(),
children: <Widget>[
for (final StoryType tab in state.tabs)
InkWell(

View File

@ -17,9 +17,9 @@ enum CustomDateTimeRange {
class CustomRangeFilterChip extends StatelessWidget {
const CustomRangeFilterChip({
super.key,
required this.range,
required this.onTap,
super.key,
});
final CustomDateTimeRange range;

View File

@ -5,10 +5,10 @@ import 'package:intl/intl.dart';
class DateTimeRangeFilterChip extends StatelessWidget {
const DateTimeRangeFilterChip({
super.key,
required this.filter,
required this.onDateTimeRangeUpdated,
required this.onDateTimeRangeRemoved,
super.key,
});
final DateTimeRangeFilter? filter;

View File

@ -5,9 +5,9 @@ import 'package:hacki/styles/styles.dart';
class PostedByFilterChip extends StatelessWidget {
const PostedByFilterChip({
super.key,
required this.filter,
required this.onChanged,
super.key,
});
final PostedByFilter? filter;

View File

@ -1,9 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:hacki/cubits/cubits.dart';
import 'package:hacki/extensions/extensions.dart';
import 'package:hacki/styles/styles.dart';
import 'package:hacki/utils/utils.dart';
class SubmitScreen extends StatefulWidget {
const SubmitScreen({super.key});
@ -45,7 +45,7 @@ class _SubmitScreenState extends State<SubmitScreen> {
listener: (BuildContext context, SubmitState state) {
if (state.status == SubmitStatus.submitted) {
Navigator.pop(context);
HapticFeedback.lightImpact();
HapticFeedbackUtil.light();
showSnackBar(
content: 'Post submitted successfully.',
);

View File

@ -6,8 +6,8 @@ import 'package:webview_flutter/webview_flutter.dart';
class WebViewScreen extends StatefulWidget {
const WebViewScreen({
super.key,
required this.url,
super.key,
});
final String url;

View File

@ -17,8 +17,8 @@ class BlocBuilder3<
BlocC extends StateStreamable<BlocCState>,
BlocCState> extends StatelessWidget {
const BlocBuilder3({
super.key,
required this.builder,
super.key,
this.blocA,
this.blocB,
this.blocC,

View File

@ -3,11 +3,17 @@ import 'package:hacki/styles/styles.dart';
class CenteredText extends StatelessWidget {
const CenteredText({
super.key,
required this.text,
super.key,
this.color = Palette.grey,
});
const CenteredText.hidden({Key? key})
: this(
key: key,
text: 'hidden',
);
const CenteredText.deleted({Key? key})
: this(
key: key,

View File

@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:hacki/blocs/blocs.dart';
@ -9,12 +8,13 @@ import 'package:hacki/models/models.dart';
import 'package:hacki/screens/widgets/widgets.dart';
import 'package:hacki/services/services.dart';
import 'package:hacki/styles/styles.dart';
import 'package:hacki/utils/utils.dart';
class CommentTile extends StatelessWidget {
const CommentTile({
super.key,
required this.comment,
required this.fetchMode,
super.key,
this.onReplyTapped,
this.onMoreTapped,
this.onEditTapped,
@ -43,13 +43,11 @@ class CommentTile extends StatelessWidget {
@override
Widget build(BuildContext context) {
if (comment.hidden) return const SizedBox.shrink();
return BlocProvider<CollapseCubit>(
key: ValueKey<String>('${comment.id}-BlocProvider'),
lazy: false,
create: (_) => CollapseCubit(
commentId: comment.id,
commentsCubit: context.tryRead<CommentsCubit>(),
collapseCache: context.tryRead<CollapseCache>() ?? CollapseCache(),
)..init(),
child: BlocBuilder3<CollapseCubit, CollapseState, PreferenceCubit,
@ -65,8 +63,7 @@ class CommentTile extends StatelessWidget {
const Color orange = Color.fromRGBO(255, 152, 0, 1);
final Color color = _getColor(level);
final Padding child = Padding(
padding: EdgeInsets.zero,
final Widget child = DeviceGestureWrapper(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
@ -119,7 +116,7 @@ class CommentTile extends StatelessWidget {
child: InkWell(
onTap: () {
if (actionable) {
HapticFeedback.selectionClick();
HapticFeedbackUtil.selection();
context.read<CollapseCubit>().collapse();
} else {
onTap?.call();
@ -172,6 +169,8 @@ class CommentTile extends StatelessWidget {
'''collapsed (${state.collapsedCount + 1})''',
color: Palette.orangeAccent,
)
else if (comment.hidden)
const CenteredText.hidden()
else if (comment.deleted)
const CenteredText.deleted()
else if (comment.dead)
@ -220,7 +219,7 @@ class CommentTile extends StatelessWidget {
Expanded(
child: TextButton(
onPressed: () {
HapticFeedback.selectionClick();
HapticFeedbackUtil.selection();
context.read<CommentsCubit>().loadMore(
comment: comment,
);
@ -340,7 +339,7 @@ class CommentTile extends StatelessWidget {
void _onTextTapped(BuildContext context) {
if (context.read<PreferenceCubit>().state.tapAnywhereToCollapseEnabled) {
HapticFeedback.selectionClick();
HapticFeedbackUtil.selection();
context.read<CollapseCubit>().collapse();
}
}

View File

@ -125,14 +125,14 @@ class _CountDownReminderState extends State<CountdownReminder>
},
child: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(
const Padding(
padding: EdgeInsets.only(
left: Dimens.pt12,
top: Dimens.pt10,
right: Dimens.pt10,
),
child: Row(
children: const <Widget>[
children: <Widget>[
Text(
'Pick up where you left off',
style: TextStyle(

View File

@ -3,10 +3,10 @@ import 'package:hacki/styles/styles.dart';
class CustomChip extends StatelessWidget {
CustomChip({
Key? key,
required this.selected,
required this.label,
required this.onSelected,
Key? key,
}) : super(key: key ?? Key(label));
final bool selected;

View File

@ -2,16 +2,17 @@ import 'dart:async';
import 'package:feature_discovery/feature_discovery.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:hacki/utils/utils.dart';
class CustomDescribedFeatureOverlay extends StatelessWidget {
const CustomDescribedFeatureOverlay({
super.key,
required this.featureId,
required this.child,
required this.tapTarget,
required this.title,
required this.description,
super.key,
this.contentLocation = ContentLocation.trivial,
this.onComplete,
});
@ -20,6 +21,7 @@ class CustomDescribedFeatureOverlay extends StatelessWidget {
final Widget title;
final Widget description;
final Widget child;
final ContentLocation contentLocation;
final VoidCallback? onComplete;
@override
@ -32,14 +34,15 @@ class CustomDescribedFeatureOverlay extends StatelessWidget {
title: title,
description: description,
barrierDismissible: false,
contentLocation: contentLocation,
onBackgroundTap: () {
unawaited(HapticFeedback.lightImpact());
HapticFeedbackUtil.light();
FeatureDiscovery.completeCurrentStep(context);
onComplete?.call();
return Future<bool>.value(true);
},
onComplete: () async {
unawaited(HapticFeedback.lightImpact());
HapticFeedbackUtil.light();
onComplete?.call();
return true;
},

View File

@ -8,15 +8,15 @@ import 'package:linkify/linkify.dart';
export 'package:hacki/screens/widgets/custom_linkify/linkifiers/linkifiers.dart';
export 'package:linkify/linkify.dart'
show
EmailElement,
EmailLinkifier,
LinkableElement,
Linkifier,
LinkifyElement,
LinkifyOptions,
LinkableElement,
TextElement,
Linkifier,
UrlElement,
UrlLinkifier,
EmailElement,
EmailLinkifier;
UrlLinkifier;
/// Callback clicked link
typedef LinkCallback = void Function(LinkableElement link);
@ -24,8 +24,8 @@ typedef LinkCallback = void Function(LinkableElement link);
/// Turns URLs into links
class Linkify extends StatelessWidget {
const Linkify({
super.key,
required this.text,
super.key,
this.linkifiers = defaultLinkifiers,
this.onOpen,
this.options = LinkifierUtil.linkifyOptions,
@ -151,8 +151,8 @@ const List<Linkifier> defaultLinkifiers = <Linkifier>[
/// Turns URLs into links
class SelectableLinkify extends StatelessWidget {
const SelectableLinkify({
super.key,
required this.text,
super.key,
this.semanticsLabel,
this.linkifiers = defaultLinkifiers,
this.onOpen,

View File

@ -1,17 +1,17 @@
import 'package:badges/badges.dart';
import 'package:flutter/material.dart' hide Badge;
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:hacki/config/constants.dart';
import 'package:hacki/cubits/cubits.dart';
import 'package:hacki/models/models.dart';
import 'package:hacki/screens/widgets/widgets.dart';
import 'package:hacki/styles/styles.dart';
import 'package:hacki/utils/haptic_feedback_util.dart';
class CustomTabBar extends StatefulWidget {
const CustomTabBar({
super.key,
required this.tabController,
super.key,
});
final TabController tabController;
@ -52,7 +52,7 @@ class _CustomTabBarState extends State<CustomTabBar> {
bottom: Dimens.pt8,
),
onTap: (_) {
HapticFeedback.selectionClick();
HapticFeedbackUtil.selection();
},
tabs: <Widget>[
for (int i = 0; i < state.tabs.length; i++)

View File

@ -0,0 +1,25 @@
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
/// A walk-around for [SelectableText] not responding to swipe gestures
/// while wrapped in a [Dismissible].
///
/// https://github.com/flutter/flutter/issues/124421#issuecomment-1500666795
class DeviceGestureWrapper extends StatelessWidget {
const DeviceGestureWrapper({
required this.child,
super.key,
});
final Widget child;
@override
Widget build(BuildContext context) {
return MediaQuery(
data: const MediaQueryData(
gestureSettings: DeviceGestureSettings(touchSlop: 7.9),
),
child: child,
);
}
}

View File

@ -9,8 +9,8 @@ import 'package:hacki/utils/utils.dart';
class ItemText extends StatelessWidget {
const ItemText({
super.key,
required this.item,
super.key,
this.onTap,
});

View File

@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_fadein/flutter_fadein.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
@ -14,13 +13,13 @@ import 'package:pull_to_refresh/pull_to_refresh.dart';
class ItemsListView<T extends Item> extends StatelessWidget {
const ItemsListView({
super.key,
required this.showWebPreview,
required this.showMetadata,
required this.showUrl,
required this.items,
required this.onTap,
required this.refreshController,
super.key,
this.useCommentTile = false,
this.showCommentBy = false,
this.enablePullDown = true,
@ -94,7 +93,7 @@ class ItemsListView<T extends Item> extends StatelessWidget {
children: <Widget>[
SlidableAction(
onPressed: (_) {
HapticFeedback.lightImpact();
HapticFeedbackUtil.light();
onPinned?.call(e);
},
backgroundColor: Palette.orange,

View File

@ -10,7 +10,6 @@ import 'package:hacki/styles/styles.dart';
class LinkPreview extends StatefulWidget {
const LinkPreview({
super.key,
required this.link,
required this.story,
required this.onTap,
@ -18,6 +17,7 @@ class LinkPreview extends StatefulWidget {
required this.showUrl,
required this.isOfflineReading,
required this.titleStyle,
super.key,
this.cache = const Duration(days: 30),
this.showMultimedia = true,
this.backgroundColor = const Color.fromRGBO(235, 235, 235, 1),

View File

@ -2,6 +2,8 @@ import 'dart:math';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:hacki/blocs/blocs.dart';
import 'package:hacki/config/constants.dart';
import 'package:hacki/models/models.dart';
import 'package:hacki/screens/widgets/link_preview/models/models.dart';
@ -11,7 +13,6 @@ import 'package:hacki/utils/link_util.dart';
class LinkView extends StatelessWidget {
LinkView({
super.key,
required this.metadata,
required this.url,
required this.readableUrl,
@ -22,6 +23,7 @@ class LinkView extends StatelessWidget {
required bool showUrl,
required this.bodyMaxLines,
required this.titleTextStyle,
super.key,
this.imageUri,
this.imagePath,
this.showMultiMedia = true,
@ -141,6 +143,8 @@ class LinkView extends StatelessWidget {
return maxLines;
}
static bool? isUsingSerifFont;
@override
Widget build(BuildContext context) {
return LayoutBuilder(
@ -151,7 +155,6 @@ class LinkView extends StatelessWidget {
final String? fontFamily =
Theme.of(context).primaryTextTheme.bodyMedium?.fontFamily;
final double textScaleFactor = MediaQuery.of(context).textScaleFactor;
final TextStyle titleStyle = titleTextStyle;
final double titleHeight = (TextPainter(
text: TextSpan(
@ -164,7 +167,6 @@ class LinkView extends StatelessWidget {
)..layout(maxWidth: bodyWidth))
.size
.height;
final int descriptionMaxLines = getDescriptionMaxLines(
MaxLineComputationParams(
fontFamily ?? Font.roboto.name,
@ -178,6 +180,8 @@ class LinkView extends StatelessWidget {
titleStyle,
);
isUsingSerifFont ??= Font.fromString(fontFamily).isSerif;
return Row(
children: <Widget>[
if (showMultiMedia)
@ -193,6 +197,8 @@ class LinkView extends StatelessWidget {
LinkUtil.launch(
url,
useHackiForHnLink: false,
offlineReading:
context.read<StoriesBloc>().state.isOfflineReading,
);
} else {
onTap();
@ -231,11 +237,7 @@ class LinkView extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(
height:
Theme.of(context).textTheme.bodyMedium?.fontFamily ==
Font.robotoSlab.name
? Dimens.pt2
: Dimens.pt4,
height: isUsingSerifFont! ? Dimens.pt2 : Dimens.pt4,
),
Text(
title,

View File

@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:hacki/config/constants.dart';
import 'package:hacki/screens/widgets/widgets.dart';
import 'package:hacki/styles/styles.dart';
@ -75,7 +74,7 @@ class _OnboardingViewState extends State<OnboardingView> {
right: Dimens.zero,
child: ElevatedButton(
onPressed: () {
HapticFeedback.lightImpact();
HapticFeedbackUtil.light();
if (pageController.page! >= 2) {
Navigator.pop(context);
} else {

View File

@ -1,19 +1,19 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:hacki/blocs/blocs.dart';
import 'package:hacki/cubits/cubits.dart';
import 'package:hacki/extensions/extensions.dart';
import 'package:hacki/models/models.dart';
import 'package:hacki/screens/widgets/widgets.dart';
import 'package:hacki/utils/utils.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
class StoriesListView extends StatefulWidget {
const StoriesListView({
super.key,
required this.storyType,
required this.header,
required this.onStoryTapped,
super.key,
});
final StoryType storyType;
@ -73,7 +73,7 @@ class _StoriesListViewState extends State<StoriesListView> {
refreshController: refreshController,
items: state.storiesByType[storyType]!,
onRefresh: () {
HapticFeedback.lightImpact();
HapticFeedbackUtil.light();
context
.read<StoriesBloc>()
.add(StoriesRefresh(type: storyType));

View File

@ -11,13 +11,13 @@ import 'package:shimmer/shimmer.dart';
class StoryTile extends StatelessWidget {
const StoryTile({
super.key,
this.hasRead = false,
required this.showWebPreview,
required this.showMetadata,
required this.showUrl,
required this.story,
required this.onTap,
super.key,
this.hasRead = false,
this.simpleTileFontSize = 16,
});

View File

@ -2,9 +2,9 @@ import 'package:flutter/material.dart';
class TapDownWrapper extends StatefulWidget {
const TapDownWrapper({
required this.child,
super.key,
this.onTap,
required this.child,
});
final VoidCallback? onTap;

View File

@ -8,6 +8,7 @@ export 'custom_circular_progress_indicator.dart';
export 'custom_described_feature_overlay.dart';
export 'custom_linkify/custom_linkify.dart';
export 'custom_tab_bar.dart';
export 'device_gesture_wrapper.dart';
export 'item_text.dart';
export 'items_list_view.dart';
export 'link_preview/link_preview.dart';

View File

@ -0,0 +1,52 @@
import 'dart:io';
import 'package:hacki/config/locator.dart';
import 'package:hacki/repositories/repositories.dart';
import 'package:in_app_review/in_app_review.dart';
class AppReviewService {
AppReviewService({PreferenceRepository? preferenceRepository})
: _preferenceRepository =
preferenceRepository ?? locator.get<PreferenceRepository>();
final PreferenceRepository _preferenceRepository;
static const String _lastRequestTimestampKey = 'lastRequestTimestamp';
static const int _differenceInDays = 3;
void requestReview() {
if (Platform.isIOS) {
_shouldDisplay().then((bool val) {
if (val) InAppReview.instance.requestReview();
});
}
}
Future<bool> _shouldDisplay() async {
final DateTime now = DateTime.now();
final int? timestamp =
await _preferenceRepository.getInt(_lastRequestTimestampKey);
if (timestamp == null) {
_preferenceRepository.setInt(
_lastRequestTimestampKey,
now.millisecondsSinceEpoch,
);
return true;
}
final DateTime lastReviewRequest =
DateTime.fromMillisecondsSinceEpoch(timestamp, isUtc: true);
final int difference = now.difference(lastReviewRequest).inDays;
if (difference >= _differenceInDays) {
_preferenceRepository.setInt(
_lastRequestTimestampKey,
now.millisecondsSinceEpoch,
);
return true;
}
return false;
}
}

View File

@ -4,7 +4,7 @@ import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:hacki/config/constants.dart';
import 'package:hacki/models/models.dart';
class LocalNotification {
class LocalNotificationService {
Future<void> pushForNewReply(Comment newReply, int storyId) async {
final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
FlutterLocalNotificationsPlugin();

View File

@ -1,6 +1,7 @@
export 'app_review_service.dart';
export 'caches/caches.dart';
export 'custom_bloc_observer.dart';
export 'fetcher.dart';
export 'firebase_client.dart';
export 'local_notification.dart';
export 'local_notification_service.dart';
export 'web_analyzer.dart';

View File

@ -9,7 +9,7 @@ import 'package:hacki/config/locator.dart';
import 'package:hacki/extensions/extensions.dart';
import 'package:hacki/models/models.dart';
import 'package:hacki/repositories/repositories.dart';
import 'package:html/dom.dart' hide Text, Comment;
import 'package:html/dom.dart' hide Comment, Text;
import 'package:html/parser.dart' as parser;
import 'package:http/http.dart';
import 'package:http/io_client.dart';
@ -110,9 +110,9 @@ class WebAnalyzer {
/// return [InfoBase]
static Future<InfoBase?> getInfo({
required Story story,
required bool offlineReading,
Duration cache = const Duration(hours: 24),
bool multimedia = true,
required bool offlineReading,
}) async {
final String key = getKey(story);
final String url = story.url;
@ -200,9 +200,9 @@ class WebAnalyzer {
}
static Future<InfoBase?> _getInfoByIsolate({
String? url,
required bool multimedia,
required Story story,
String? url,
}) async {
List<dynamic>? res;

View File

@ -0,0 +1,7 @@
import 'package:flutter/services.dart';
abstract class HapticFeedbackUtil {
static void selection() => HapticFeedback.selectionClick();
static void light() => HapticFeedback.lightImpact();
}

View File

@ -28,7 +28,6 @@ abstract class ThemeUtil {
statusBarColor: Palette.transparent,
),
);
break;
case AdaptiveThemeMode.dark:
SystemChrome.setSystemUIOverlayStyle(
const SystemUiOverlayStyle(
@ -37,7 +36,6 @@ abstract class ThemeUtil {
statusBarColor: Palette.transparent,
),
);
break;
case AdaptiveThemeMode.system:
case null:
switch (brightness) {
@ -49,7 +47,6 @@ abstract class ThemeUtil {
statusBarColor: Palette.transparent,
),
);
break;
case Brightness.dark:
SystemChrome.setSystemUIOverlayStyle(
const SystemUiOverlayStyle(
@ -58,9 +55,7 @@ abstract class ThemeUtil {
statusBarColor: Palette.transparent,
),
);
break;
}
break;
}
}
}

View File

@ -1,4 +1,5 @@
export 'debouncer.dart';
export 'haptic_feedback_util.dart';
export 'html_util.dart';
export 'link_util.dart';
export 'linkifier_util.dart';

View File

@ -5,58 +5,50 @@ packages:
dependency: transitive
description:
name: _fe_analyzer_shared
sha256: "0c80aeab9bc807ab10022cd3b2f4cf2ecdf231949dc1ddd9442406a003f19201"
sha256: "405666cd3cf0ee0a48d21ec67e65406aad2c726d9fa58840d3375e7bdcd32a07"
url: "https://pub.dev"
source: hosted
version: "52.0.0"
version: "60.0.0"
adaptive_theme:
dependency: "direct main"
description:
name: adaptive_theme
sha256: "61bde10390e937d11d05c6cf0d5cf378a73d49f9a442262e43613dae60ed0b3f"
sha256: "3568bb526d4823c7bb35f9ce3604af15e04cc0e9cc4f257da3604fe6b48d74ae"
url: "https://pub.dev"
source: hosted
version: "3.2.0"
version: "3.2.1"
analyzer:
dependency: transitive
description:
name: analyzer
sha256: cd8ee83568a77f3ae6b913a36093a1c9b1264e7cb7f834d9ddd2311dade9c1f4
sha256: "1952250bd005bacb895a01bf1b4dc00e3ba1c526cf47dca54dfe24979c65f5b3"
url: "https://pub.dev"
source: hosted
version: "5.4.0"
archive:
dependency: transitive
description:
name: archive
sha256: "80e5141fafcb3361653ce308776cfd7d45e6e9fbb429e14eec571382c0c5fecb"
url: "https://pub.dev"
source: hosted
version: "3.3.2"
version: "5.12.0"
args:
dependency: transitive
description:
name: args
sha256: "4cab82a83ffef80b262ddedf47a0a8e56ee6fbf7fe21e6e768b02792034dd440"
sha256: c372bb384f273f0c2a8aaaa226dad84dc27c8519a691b888725dec59518ad53a
url: "https://pub.dev"
source: hosted
version: "2.4.0"
version: "2.4.1"
async:
dependency: transitive
description:
name: async
sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
url: "https://pub.dev"
source: hosted
version: "2.10.0"
version: "2.11.0"
badges:
dependency: "direct main"
description:
name: badges
sha256: "461031a60efbb95276f52107f63d5d45008b5ca1eb7f8ca440cadda9ec2143b0"
sha256: "6e7f3ec561ec08f47f912cfe349d4a1707afdc8dda271e17b046aa6d42c89e77"
url: "https://pub.dev"
source: hosted
version: "3.0.2"
version: "3.1.1"
bloc:
dependency: "direct main"
description:
@ -109,10 +101,10 @@ packages:
dependency: transitive
description:
name: characters
sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
url: "https://pub.dev"
source: hosted
version: "1.2.1"
version: "1.3.0"
clipboard:
dependency: "direct main"
description:
@ -133,18 +125,18 @@ packages:
dependency: "direct main"
description:
name: collection
sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0
sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c"
url: "https://pub.dev"
source: hosted
version: "1.17.0"
version: "1.17.1"
connectivity_plus:
dependency: "direct main"
description:
name: connectivity_plus
sha256: "8875e8ed511a49f030e313656154e4bbbcef18d68dfd32eb853fac10bce48e96"
sha256: "45262924896ff72a8cd92b722bb7e3d5020f9e0724531a3e10e22ddae2005991"
url: "https://pub.dev"
source: hosted
version: "3.0.3"
version: "4.0.0"
connectivity_plus_platform_interface:
dependency: transitive
description:
@ -181,10 +173,10 @@ packages:
dependency: transitive
description:
name: crypto
sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67
sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab
url: "https://pub.dev"
source: hosted
version: "3.0.2"
version: "3.0.3"
csslib:
dependency: transitive
description:
@ -205,10 +197,10 @@ packages:
dependency: "direct main"
description:
name: device_info_plus
sha256: "1d6e5a61674ba3a68fb048a7c7b4ff4bebfed8d7379dbe8f2b718231be9a7c95"
sha256: "9b1a0c32b2a503f8fe9f8764fac7b5fcd4f6bd35d8f49de5350bccf9e2a33b8a"
url: "https://pub.dev"
source: hosted
version: "8.1.0"
version: "9.0.0"
device_info_plus_platform_interface:
dependency: transitive
description:
@ -229,10 +221,10 @@ packages:
dependency: "direct main"
description:
name: dio
sha256: "3e5c4a94d112540d0c9a6b7f3969832e1604eb8cde0f88d0808382f9f632100b"
sha256: "347d56c26d63519552ef9a569f2a593dda99a81fdbdff13c584b7197cfe05059"
url: "https://pub.dev"
source: hosted
version: "5.0.3"
version: "5.1.2"
equatable:
dependency: "direct main"
description:
@ -270,10 +262,10 @@ packages:
dependency: transitive
description:
name: ffi
sha256: a38574032c5f1dd06c4aee541789906c12ccaab8ba01446e800d9c5b79c4a978
sha256: ed5337a5660c506388a9f012be0288fb38b49020ce2b45fe1f8b8323fe429f99
url: "https://pub.dev"
source: hosted
version: "2.0.1"
version: "2.0.2"
file:
dependency: transitive
description:
@ -352,26 +344,26 @@ packages:
dependency: "direct main"
description:
name: flutter_local_notifications
sha256: "293995f94e120c8afce768981bd1fa9c5d6de67c547568e3b42ae2defdcbb4a0"
sha256: "20c92629902b125cb624efdbacbbe98806b3c0b01adb3d84d1c72198b3eafb1a"
url: "https://pub.dev"
source: hosted
version: "13.0.0"
version: "14.0.1"
flutter_local_notifications_linux:
dependency: transitive
description:
name: flutter_local_notifications_linux
sha256: "8f6c1611e0c4a88a382691a97bb3c3feb24cc0c0b54152b8b5fb7ffb837f7fbf"
sha256: "33f741ef47b5f63cc7f78fe75eeeac7e19f171ff3c3df054d84c1e38bedb6a03"
url: "https://pub.dev"
source: hosted
version: "3.0.0"
version: "4.0.0+1"
flutter_local_notifications_platform_interface:
dependency: transitive
description:
name: flutter_local_notifications_platform_interface
sha256: "5ec1feac5f7f7d9266759488bc5f76416152baba9aa1b26fe572246caa00d1ab"
sha256: "7cf643d6d5022f3baed0be777b0662cce5919c0a7b86e700299f22dc4ae660ef"
url: "https://pub.dev"
source: hosted
version: "6.0.0"
version: "7.0.0+1"
flutter_secure_storage:
dependency: "direct main"
description:
@ -432,10 +424,10 @@ packages:
dependency: "direct main"
description:
name: flutter_slidable
sha256: "6c68e1fad129b4b807b2218ef4cf7f7f6f61c5ec8861c990dc2278d9d03cb09f"
sha256: cc4231579e3eae41ae166660df717f4bad1359c87f4a4322ad8ba1befeb3d2be
url: "https://pub.dev"
source: hosted
version: "2.0.0"
version: "3.0.0"
flutter_test:
dependency: "direct dev"
description: flutter
@ -479,10 +471,10 @@ packages:
dependency: "direct main"
description:
name: get_it
sha256: "290fde3a86072e4b37dbb03c07bec6126f0ecc28dad403c12ffe2e5a2d751ab7"
sha256: "529de303c739fca98cd7ece5fca500d8ff89649f1bb4b4e94fb20954abcd7468"
url: "https://pub.dev"
source: hosted
version: "7.2.0"
version: "7.6.0"
glob:
dependency: transitive
description:
@ -503,10 +495,10 @@ packages:
dependency: "direct main"
description:
name: html
sha256: d9793e10dbe0e6c364f4c59bf3e01fb33a9b2a674bc7a1081693dba0614b6269
sha256: "58e3491f7bf0b6a4ea5110c0c688877460d1a6366731155c4a4580e7ded773e8"
url: "https://pub.dev"
source: hosted
version: "0.15.1"
version: "0.15.3"
html_unescape:
dependency: "direct main"
description:
@ -519,10 +511,10 @@ packages:
dependency: "direct main"
description:
name: http
sha256: "6aa2946395183537c8b880962d935877325d6a09a2867c3970c05c0fed6ac482"
sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2"
url: "https://pub.dev"
source: hosted
version: "0.13.5"
version: "0.13.6"
http_multi_server:
dependency: transitive
description:
@ -547,6 +539,21 @@ packages:
url: "https://pub.dev"
source: hosted
version: "9.1.0"
in_app_review:
dependency: "direct main"
description:
path: "components/in_app_review"
relative: true
source: path
version: "2.0.6"
in_app_review_platform_interface:
dependency: transitive
description:
name: in_app_review_platform_interface
sha256: b12ec9aaf6b34d3a72aa95895eb252b381896246bdad4ef378d444affe8410ef
url: "https://pub.dev"
source: hosted
version: "2.0.4"
integration_test:
dependency: "direct dev"
description: flutter
@ -556,10 +563,10 @@ packages:
dependency: "direct main"
description:
name: intl
sha256: a3715e3bc90294e971cb7dc063fbf3cd9ee0ebf8604ffeafabd9e6f16abbdbe6
sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d"
url: "https://pub.dev"
source: hosted
version: "0.18.0"
version: "0.18.1"
io:
dependency: transitive
description:
@ -572,18 +579,18 @@ packages:
dependency: transitive
description:
name: js
sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7"
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
url: "https://pub.dev"
source: hosted
version: "0.6.5"
version: "0.6.7"
linkify:
dependency: "direct main"
description:
name: linkify
sha256: bdfbdafec6cdc9cd0ebb333a868cafc046714ad508e48be8095208c54691d959
sha256: "4139ea77f4651ab9c315b577da2dd108d9aa0bd84b5d03d33323f1970c645832"
url: "https://pub.dev"
source: hosted
version: "4.1.0"
version: "5.0.0"
logger:
dependency: "direct main"
description:
@ -604,10 +611,10 @@ packages:
dependency: transitive
description:
name: matcher
sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72"
sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb"
url: "https://pub.dev"
source: hosted
version: "0.12.13"
version: "0.12.15"
material_color_utilities:
dependency: transitive
description:
@ -628,10 +635,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42"
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
url: "https://pub.dev"
source: hosted
version: "1.8.0"
version: "1.9.1"
mime:
dependency: transitive
description:
@ -668,10 +675,10 @@ packages:
dependency: transitive
description:
name: node_preamble
sha256: "8ebdbaa3b96d5285d068f80772390d27c21e1fa10fb2df6627b1b9415043608d"
sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
version: "2.0.2"
octo_image:
dependency: transitive
description:
@ -692,10 +699,10 @@ packages:
dependency: "direct main"
description:
name: package_info_plus
sha256: "8df5ab0a481d7dc20c0e63809e90a588e496d276ba53358afc4c4443d0a00697"
sha256: d39e8fbff4c5aef4592737e25ad6ac500df006ce7a7a8e1f838ce1256e167542
url: "https://pub.dev"
source: hosted
version: "3.0.3"
version: "4.0.0"
package_info_plus_platform_interface:
dependency: transitive
description:
@ -708,58 +715,58 @@ packages:
dependency: "direct main"
description:
name: path
sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
url: "https://pub.dev"
source: hosted
version: "1.8.2"
version: "1.8.3"
path_provider:
dependency: "direct main"
description:
name: path_provider
sha256: dcea5feb97d8abf90cab9e9030b497fb7c3cbf26b7a1fe9e3ef7dcb0a1ddec95
sha256: "3087813781ab814e4157b172f1a11c46be20179fcc9bea043e0fba36bc0acaa2"
url: "https://pub.dev"
source: hosted
version: "2.0.12"
version: "2.0.15"
path_provider_android:
dependency: "direct main"
description:
name: path_provider_android
sha256: a776c088d671b27f6e3aa8881d64b87b3e80201c64e8869b811325de7a76c15e
sha256: "2cec049d282c7f13c594b4a73976b0b4f2d7a1838a6dd5aaf7bd9719196bee86"
url: "https://pub.dev"
source: hosted
version: "2.0.22"
version: "2.0.27"
path_provider_foundation:
dependency: "direct main"
description:
name: path_provider_foundation
sha256: "62a68e7e1c6c459f9289859e2fae58290c981ce21d1697faf54910fe1faa4c74"
sha256: "1995d88ec2948dac43edf8fe58eb434d35d22a2940ecee1a9fefcd62beee6eb3"
url: "https://pub.dev"
source: hosted
version: "2.1.1"
version: "2.2.3"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
sha256: "2e32f1640f07caef0d3cb993680f181c79e54a3827b997d5ee221490d131fbd9"
sha256: "2ae08f2216225427e64ad224a24354221c2c7907e448e6e0e8b57b1eb9f10ad1"
url: "https://pub.dev"
source: hosted
version: "2.1.8"
version: "2.1.10"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
sha256: f0abc8ebd7253741f05488b4813d936b4d07c6bae3e86148a09e342ee4b08e76
sha256: "57585299a729335f1298b43245842678cb9f43a6310351b18fb577d6e33165ec"
url: "https://pub.dev"
source: hosted
version: "2.0.5"
version: "2.0.6"
path_provider_windows:
dependency: transitive
description:
name: path_provider_windows
sha256: bcabbe399d4042b8ee687e17548d5d3f527255253b4a639f5f8d2094a9c2b45c
sha256: d3f80b32e83ec208ac95253e0cd4d298e104fbc63cb29c5c69edaed43b0c69d6
url: "https://pub.dev"
source: hosted
version: "2.1.3"
version: "2.1.6"
pedantic:
dependency: transitive
description:
@ -772,10 +779,10 @@ packages:
dependency: transitive
description:
name: petitparser
sha256: "49392a45ced973e8d94a85fdb21293fbb40ba805fc49f2965101ae748a3683b4"
sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750
url: "https://pub.dev"
source: hosted
version: "5.1.0"
version: "5.4.0"
platform:
dependency: transitive
description:
@ -788,10 +795,10 @@ packages:
dependency: transitive
description:
name: plugin_platform_interface
sha256: dbf0f707c78beedc9200146ad3cb0ab4d5da13c246336987be6940f026500d3a
sha256: "6a2128648c854906c53fa8e33986fc0247a1116122f9534dd20e3ab9e16a32bc"
url: "https://pub.dev"
source: hosted
version: "2.1.3"
version: "2.1.4"
pool:
dependency: transitive
description:
@ -820,10 +827,10 @@ packages:
dependency: transitive
description:
name: pub_semver
sha256: "307de764d305289ff24ad257ad5c5793ce56d04947599ad68b3baa124105fc17"
sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c"
url: "https://pub.dev"
source: hosted
version: "2.1.3"
version: "2.1.4"
pull_to_refresh:
dependency: "direct main"
description:
@ -845,10 +852,10 @@ packages:
dependency: "direct main"
description:
name: responsive_builder
sha256: "8eed603781a53fe1804a9ba50089ceb4882887f9c5b84ff139b03d8583a12fc9"
sha256: a38ba9ba86c9daf08904674553034b651377b1d685d10ee450d8350ae51f76ec
url: "https://pub.dev"
source: hosted
version: "0.5.1"
version: "0.7.0"
rxdart:
dependency: "direct main"
description:
@ -857,118 +864,126 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.27.7"
scrollable_positioned_list:
dependency: "direct main"
description:
name: scrollable_positioned_list
sha256: "1b54d5f1329a1e263269abc9e2543d90806131aa14fe7c6062a8054d57249287"
url: "https://pub.dev"
source: hosted
version: "0.3.8"
sembast:
dependency: "direct main"
description:
name: sembast
sha256: "4997717aa84f0622691815d7e2739988b7f7d3a463302fc878f7d5acfa748e96"
sha256: a784dbcf313ff38a7f57249694c64a6bcf79f704dbec127958459a7737716830
url: "https://pub.dev"
source: hosted
version: "3.4.0+6"
version: "3.4.4"
share_plus:
dependency: "direct main"
description:
name: share_plus
sha256: "8c6892037b1824e2d7e8f59d54b3105932899008642e6372e5079c6939b4b625"
sha256: "322a1ec9d9fe07e2e2252c098ce93d12dbd06133cc4c00ffe6a4ef505c295c17"
url: "https://pub.dev"
source: hosted
version: "6.3.1"
version: "7.0.0"
share_plus_platform_interface:
dependency: transitive
description:
name: share_plus_platform_interface
sha256: "82ddd4ab9260c295e6e39612d4ff00390b9a7a21f1bb1da771e2f232d80ab8a1"
sha256: "0c6e61471bd71b04a138b8b588fa388e66d8b005e6f2deda63371c5c505a0981"
url: "https://pub.dev"
source: hosted
version: "3.2.0"
version: "3.2.1"
shared_preferences:
dependency: "direct main"
description:
name: shared_preferences
sha256: "5949029e70abe87f75cfe59d17bf5c397619c4b74a099b10116baeb34786fad9"
sha256: "16d3fb6b3692ad244a695c0183fca18cf81fd4b821664394a781de42386bf022"
url: "https://pub.dev"
source: hosted
version: "2.0.17"
version: "2.1.1"
shared_preferences_android:
dependency: "direct main"
description:
name: shared_preferences_android
sha256: "955e9736a12ba776bdd261cf030232b30eadfcd9c79b32a3250dd4a494e8c8f7"
sha256: "6478c6bbbecfe9aced34c483171e90d7c078f5883558b30ec3163cf18402c749"
url: "https://pub.dev"
source: hosted
version: "2.0.15"
version: "2.1.4"
shared_preferences_foundation:
dependency: "direct main"
description:
name: shared_preferences_foundation
sha256: "2b55c18636a4edc529fa5cd44c03d3f3100c00513f518c5127c951978efcccd0"
sha256: e014107bb79d6d3297196f4f2d0db54b5d1f85b8ea8ff63b8e8b391a02700feb
url: "https://pub.dev"
source: hosted
version: "2.1.3"
version: "2.2.2"
shared_preferences_linux:
dependency: transitive
description:
name: shared_preferences_linux
sha256: f8ea038aa6da37090093974ebdcf4397010605fd2ff65c37a66f9d28394cb874
sha256: "9d387433ca65717bbf1be88f4d5bb18f10508917a8fa2fb02e0fd0d7479a9afa"
url: "https://pub.dev"
source: hosted
version: "2.1.3"
version: "2.2.0"
shared_preferences_platform_interface:
dependency: transitive
description:
name: shared_preferences_platform_interface
sha256: da9431745ede5ece47bc26d5d73a9d3c6936ef6945c101a5aca46f62e52c1cf3
sha256: fb5cf25c0235df2d0640ac1b1174f6466bd311f621574997ac59018a6664548d
url: "https://pub.dev"
source: hosted
version: "2.1.0"
version: "2.2.0"
shared_preferences_web:
dependency: transitive
description:
name: shared_preferences_web
sha256: a4b5bc37fe1b368bbc81f953197d55e12f49d0296e7e412dfe2d2d77d6929958
sha256: "74083203a8eae241e0de4a0d597dbedab3b8fef5563f33cf3c12d7e93c655ca5"
url: "https://pub.dev"
source: hosted
version: "2.0.4"
version: "2.1.0"
shared_preferences_windows:
dependency: transitive
description:
name: shared_preferences_windows
sha256: "5eaf05ae77658d3521d0e993ede1af962d4b326cd2153d312df716dc250f00c9"
sha256: "5e588e2efef56916a3b229c3bfe81e6a525665a454519ca51dbcc4236a274173"
url: "https://pub.dev"
source: hosted
version: "2.1.3"
version: "2.2.0"
shelf:
dependency: transitive
description:
name: shelf
sha256: c24a96135a2ccd62c64b69315a14adc5c3419df63b4d7c05832a346fdb73682c
sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4
url: "https://pub.dev"
source: hosted
version: "1.4.0"
version: "1.4.1"
shelf_packages_handler:
dependency: transitive
description:
name: shelf_packages_handler
sha256: aef74dc9195746a384843102142ab65b6a4735bb3beea791e63527b88cc83306
sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e"
url: "https://pub.dev"
source: hosted
version: "3.0.1"
version: "3.0.2"
shelf_static:
dependency: transitive
description:
name: shelf_static
sha256: e792b76b96a36d4a41b819da593aff4bdd413576b3ba6150df5d8d9996d2e74c
sha256: a41d3f53c4adf0f57480578c1d61d90342cd617de7fc8077b1304643c2d85c1e
url: "https://pub.dev"
source: hosted
version: "1.1.1"
version: "1.1.2"
shelf_web_socket:
dependency: transitive
description:
name: shelf_web_socket
sha256: a988c0e8d8ffbdb8a28aa7ec8e449c260f3deb808781fe1284d22c5bba7156e8
sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1"
url: "https://pub.dev"
source: hosted
version: "1.0.3"
version: "1.0.4"
shimmer:
dependency: "direct main"
description:
@ -994,10 +1009,10 @@ packages:
dependency: transitive
description:
name: source_maps
sha256: "490098075234dcedb83c5d949b4c93dad5e6b7702748de000be2b57b8e6b2427"
sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703"
url: "https://pub.dev"
source: hosted
version: "0.10.11"
version: "0.10.12"
source_span:
dependency: transitive
description:
@ -1010,18 +1025,18 @@ packages:
dependency: transitive
description:
name: sqflite
sha256: "78324387dc81df14f78df06019175a86a2ee0437624166c382e145d0a7fd9a4f"
sha256: b4d6710e1200e96845747e37338ea8a819a12b51689a3bcf31eff0003b37a0b9
url: "https://pub.dev"
source: hosted
version: "2.2.4+1"
version: "2.2.8+4"
sqflite_common:
dependency: transitive
description:
name: sqflite_common
sha256: bfd6973aaeeb93475bc0d875ac9aefddf7965ef22ce09790eb963992ffc5183f
sha256: e77abf6ff961d69dfef41daccbb66b51e9983cdd5cb35bf30733598057401555
url: "https://pub.dev"
source: hosted
version: "2.4.2+2"
version: "2.4.5"
stack_trace:
dependency: transitive
description:
@ -1065,10 +1080,10 @@ packages:
dependency: transitive
description:
name: synchronized
sha256: "33b31b6beb98100bf9add464a36a8dd03eb10c7a8cf15aeec535e9b054aaf04b"
sha256: "5fcbd27688af6082f5abd611af56ee575342c30e87541d0245f7ff99faa02c60"
url: "https://pub.dev"
source: hosted
version: "3.0.1"
version: "3.1.0"
term_glyph:
dependency: transitive
description:
@ -1081,50 +1096,42 @@ packages:
dependency: transitive
description:
name: test
sha256: a5fcd2d25eeadbb6589e80198a47d6a464ba3e2049da473943b8af9797900c2d
sha256: "3dac9aecf2c3991d09b9cdde4f98ded7b30804a88a0d7e4e7e1678e78d6b97f4"
url: "https://pub.dev"
source: hosted
version: "1.22.0"
version: "1.24.1"
test_api:
dependency: transitive
description:
name: test_api
sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206
sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb
url: "https://pub.dev"
source: hosted
version: "0.4.16"
version: "0.5.1"
test_core:
dependency: transitive
description:
name: test_core
sha256: "0ef9755ec6d746951ba0aabe62f874b707690b5ede0fecc818b138fcc9b14888"
sha256: "5138dbffb77b2289ecb12b81c11ba46036590b72a64a7a90d6ffb880f1a29e93"
url: "https://pub.dev"
source: hosted
version: "0.4.20"
version: "0.5.1"
timezone:
dependency: transitive
description:
name: timezone
sha256: "24c8fcdd49a805d95777a39064862133ff816ebfffe0ceff110fb5960e557964"
sha256: "1cfd8ddc2d1cfd836bc93e67b9be88c3adaeca6f40a00ca999104c30693cdca0"
url: "https://pub.dev"
source: hosted
version: "0.9.1"
tuple:
dependency: "direct main"
description:
name: tuple
sha256: "0ea99cd2f9352b2586583ab2ce6489d1f95a5f6de6fb9492faaf97ae2060f0aa"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
version: "0.9.2"
typed_data:
dependency: transitive
description:
name: typed_data
sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5"
sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
url: "https://pub.dev"
source: hosted
version: "1.3.1"
version: "1.3.2"
universal_platform:
dependency: "direct main"
description:
@ -1137,66 +1144,66 @@ packages:
dependency: "direct main"
description:
name: url_launcher
sha256: e8f2efc804810c0f2f5b485f49e7942179f56eabcfe81dce3387fec4bb55876b
sha256: eb1e00ab44303d50dd487aab67ebc575456c146c6af44422f9c13889984c00f3
url: "https://pub.dev"
source: hosted
version: "6.1.9"
version: "6.1.11"
url_launcher_android:
dependency: transitive
description:
name: url_launcher_android
sha256: "3e2f6dfd2c7d9cd123296cab8ef66cfc2c1a13f5845f42c7a0f365690a8a7dd1"
sha256: "1a5848f598acc5b7d8f7c18b8cb834ab667e59a13edc3c93e9d09cf38cc6bc87"
url: "https://pub.dev"
source: hosted
version: "6.0.23"
version: "6.0.34"
url_launcher_ios:
dependency: transitive
description:
name: url_launcher_ios
sha256: "0a5af0aefdd8cf820dd739886efb1637f1f24489900204f50984634c07a54815"
sha256: "9af7ea73259886b92199f9e42c116072f05ff9bea2dcb339ab935dfc957392c2"
url: "https://pub.dev"
source: hosted
version: "6.1.0"
version: "6.1.4"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
sha256: "318c42cba924e18180c029be69caf0a1a710191b9ec49bb42b5998fdcccee3cc"
sha256: "207f4ddda99b95b4d4868320a352d374b0b7e05eefad95a4a26f57da413443f5"
url: "https://pub.dev"
source: hosted
version: "3.0.2"
version: "3.0.5"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
sha256: "41988b55570df53b3dd2a7fc90c76756a963de6a8c5f8e113330cb35992e2094"
sha256: "91ee3e75ea9dadf38036200c5d3743518f4a5eb77a8d13fda1ee5764373f185e"
url: "https://pub.dev"
source: hosted
version: "3.0.2"
version: "3.0.5"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
sha256: "4eae912628763eb48fc214522e58e942fd16ce195407dbf45638239523c759a6"
sha256: "6c9ca697a5ae218ce56cece69d46128169a58aa8653c1b01d26fcd4aad8c4370"
url: "https://pub.dev"
source: hosted
version: "2.1.1"
version: "2.1.2"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
sha256: "44d79408ce9f07052095ef1f9a693c258d6373dc3944249374e30eff7219ccb0"
sha256: "81fe91b6c4f84f222d186a9d23c73157dc4c8e1c71489c4d08be1ad3b228f1aa"
url: "https://pub.dev"
source: hosted
version: "2.0.14"
version: "2.0.16"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
sha256: b6217370f8eb1fd85c8890c539f5a639a01ab209a36db82c921ebeacefc7a615
sha256: "254708f17f7c20a9c8c471f67d86d76d4a3f9c1591aad1e15292008aceb82771"
url: "https://pub.dev"
source: hosted
version: "3.0.3"
version: "3.0.6"
uuid:
dependency: transitive
description:
@ -1217,18 +1224,18 @@ packages:
dependency: "direct dev"
description:
name: very_good_analysis
sha256: ebc48c51db35beeeec8c414e32f7bd78e612bd7f5992ccb0d46e19edaeb40b08
sha256: "5f77d7c00d6010d8ad93ac5d91ecc851c216bcc1e7a51e56c3c01b27152453bb"
url: "https://pub.dev"
source: hosted
version: "4.0.0+1"
version: "5.0.0"
vm_service:
dependency: transitive
description:
name: vm_service
sha256: e7fb6c2282f7631712b69c19d1bff82f3767eea33a2321c14fa59ad67ea391c7
sha256: f6deed8ed625c52864792459709183da231ebf66ff0cf09e69b573227c377efe
url: "https://pub.dev"
source: hosted
version: "9.4.0"
version: "11.3.0"
wakelock:
dependency: "direct main"
description:
@ -1273,26 +1280,26 @@ packages:
dependency: transitive
description:
name: watcher
sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0"
sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8"
url: "https://pub.dev"
source: hosted
version: "1.0.2"
version: "1.1.0"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
sha256: ca49c0bc209c687b887f30527fb6a9d80040b072cc2990f34b9bec3e7663101b
sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b
url: "https://pub.dev"
source: hosted
version: "2.3.0"
version: "2.4.0"
webdriver:
dependency: transitive
description:
name: webdriver
sha256: ef67178f0cc7e32c1494645b11639dd1335f1d18814aa8435113a92e9ef9d841
sha256: "3c923e918918feeb90c4c9fdf1fe39220fa4c0e8e2c0fffaded174498ef86c49"
url: "https://pub.dev"
source: hosted
version: "3.0.1"
version: "3.0.2"
webkit_inspection_protocol:
dependency: transitive
description:
@ -1305,42 +1312,50 @@ packages:
dependency: "direct main"
description:
name: webview_flutter
sha256: f7ec234830f86d0ef2bd664e8460b0038b8c1a83ff076035cad74ac70273753c
sha256: "1a37bdbaaf5fbe09ad8579ab09ecfd473284ce482f900b5aea27cf834386a567"
url: "https://pub.dev"
source: hosted
version: "4.0.2"
version: "4.2.0"
webview_flutter_android:
dependency: transitive
description:
name: webview_flutter_android
sha256: "5f49a6e5fc59e21fcec5e1bbcd401afbee9792a24a4f3d9cef9b5bb0cd1e3767"
sha256: "1acea8def62592123e2fbbca164ed8681a98a890bdcbb88f916d5b4a22687759"
url: "https://pub.dev"
source: hosted
version: "3.2.4"
version: "3.7.0"
webview_flutter_platform_interface:
dependency: transitive
description:
name: webview_flutter_platform_interface
sha256: "8b2262dda5d26eabc600a7282a8c16a9473a0c765526afb0ffc33eef912f7968"
sha256: "78715dc442b7849dbde74e92bb67de1cecf5addf95531c5fb474e72f5fe9a507"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
version: "2.3.0"
webview_flutter_wkwebview:
dependency: transitive
description:
name: webview_flutter_wkwebview
sha256: "92e7e7fa468f1df597fb9d37bcf1f303175cbe147c4dbdf06ecc323d950116eb"
sha256: "4646bb68297803bdbb96d46853e8fcb560d6cb5e04153fa64581535767875dfe"
url: "https://pub.dev"
source: hosted
version: "3.0.5"
version: "3.4.3"
win32:
dependency: transitive
dependency: "direct overridden"
description:
name: win32
sha256: c9ebe7ee4ab0c2194e65d3a07d8c54c5d00bb001b76081c4a04cdb8448b59e46
sha256: "6ca3aaab1790eeb1f5cad232e33d9c53ba66e884dd3e7686c4e730bffc45f1a3"
url: "https://pub.dev"
source: hosted
version: "3.1.3"
version: "5.0.2"
win32_registry:
dependency: transitive
description:
name: win32_registry
sha256: e4506d60b7244251bc59df15656a3093501c37fb5af02105a944d73eb95be4c9
url: "https://pub.dev"
source: hosted
version: "1.1.1"
workmanager:
dependency: "direct main"
description:
@ -1361,18 +1376,18 @@ packages:
dependency: transitive
description:
name: xml
sha256: "979ee37d622dec6365e2efa4d906c37470995871fe9ae080d967e192d88286b5"
sha256: "5bc72e1e45e941d825fd7468b9b4cc3b9327942649aeb6fc5cdbf135f0a86e84"
url: "https://pub.dev"
source: hosted
version: "6.2.2"
version: "6.3.0"
yaml:
dependency: transitive
description:
name: yaml
sha256: "23812a9b125b48d4007117254bca50abb6c712352927eece9e155207b1db2370"
sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5"
url: "https://pub.dev"
source: hosted
version: "3.1.1"
version: "3.1.2"
sdks:
dart: ">=2.19.0 <3.0.0"
flutter: ">=3.7.9"
dart: ">=3.0.0 <4.0.0"
flutter: ">=3.10.1"

View File

@ -1,11 +1,11 @@
name: hacki
description: A Hacker News reader.
version: 1.4.3+107
version: 1.6.0+110
publish_to: none
environment:
sdk: ">=2.17.0 <3.0.0"
flutter: "3.7.9"
sdk: ">=3.0.0 <4.0.0"
flutter: "3.10.1"
dependencies:
adaptive_theme: ^3.2.0
@ -13,9 +13,9 @@ dependencies:
bloc: ^8.1.1
cached_network_image: ^3.2.3
clipboard: ^0.1.3
collection: ^1.17.0
connectivity_plus: ^3.0.2
device_info_plus: ^8.1.0
collection: ^1.17.1
connectivity_plus: ^4.0.0
device_info_plus: ^9.0.0
dio: ^5.0.3
equatable: ^2.0.5
fast_gbk: ^1.0.0
@ -31,10 +31,10 @@ dependencies:
flutter_fadein: ^2.0.0
flutter_feather_icons: 2.0.0+1
flutter_inappwebview: ^5.7.2+3
flutter_local_notifications: ^13.0.0
flutter_local_notifications: ^14.0.1
flutter_secure_storage: ^8.0.0
flutter_siri_suggestions: ^2.1.0
flutter_slidable: ^2.0.0
flutter_slidable: ^3.0.0
font_awesome_flutter: ^10.3.0
gbk_codec: ^0.4.0
get_it: ^7.2.0
@ -43,11 +43,13 @@ dependencies:
html_unescape: ^2.0.0
http: ^0.13.5
hydrated_bloc: ^9.1.0
in_app_review:
path: components/in_app_review
intl: ^0.18.0
linkify: ^4.1.0
linkify: ^5.0.0
logger: ^1.3.0
memoize: ^3.0.0
package_info_plus: ^3.0.3
package_info_plus: ^4.0.0
path: ^1.8.2
path_provider: ^2.0.12
path_provider_android: ^2.0.22
@ -57,23 +59,26 @@ dependencies:
url: https://github.com/livinglist/flutter_pulltorefresh
ref: master
receive_sharing_intent: ^1.4.5
responsive_builder: ^0.5.1
responsive_builder: ^0.7.0
rxdart: ^0.27.7
scrollable_positioned_list: ^0.3.5
sembast: ^3.4.0+6
share_plus: ^6.3.1
share_plus: ^7.0.0
shared_preferences: ^2.0.17
shared_preferences_android: ^2.0.15
shared_preferences_foundation: ^2.1.3
shimmer: ^2.0.0
synced_shared_preferences:
path: components/synced_shared_preferences
tuple: ^2.0.1
universal_platform: ^1.0.0+1
url_launcher: ^6.1.9
wakelock: ^0.6.1+2
wakelock: ^0.6.2
webview_flutter: ^4.0.2
workmanager: ^0.5.1
dependency_overrides:
win32: ^5.0.2
dev_dependencies:
bloc_test: ^9.1.0
flutter_driver:
@ -83,7 +88,7 @@ dev_dependencies:
integration_test:
sdk: flutter
mocktail: ^0.3.0
very_good_analysis: ^4.0.0+1
very_good_analysis: ^5.0.0
flutter:
uses-material-design: true
@ -108,5 +113,10 @@ flutter:
- asset: assets/fonts/ubuntu_mono/UbuntuMono-Regular.ttf
- asset: assets/fonts/ubuntu_mono/UbuntuMono-Bold.ttf
weight: 700
- family: NotoSerif
fonts:
- asset: assets/fonts/noto_serif/NotoSerif-Regular.ttf
- asset: assets/fonts/noto_serif/NotoSerif-Bold.ttf
weight: 700