Skip to content

Commit

Permalink
chore: Update example
Browse files Browse the repository at this point in the history
  • Loading branch information
lijy91 committed Jan 28, 2024
1 parent b425482 commit 58e4548
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 133 deletions.
30 changes: 1 addition & 29 deletions packages/protocol_handler/example/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
include: package:mostly_reasonable_lints/flutter.yaml
9 changes: 4 additions & 5 deletions packages/protocol_handler/example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import 'dart:io';

import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:protocol_handler/protocol_handler.dart';
import 'package:protocol_handler_example/pages/home.dart';
import 'package:window_manager/window_manager.dart';

import './pages/home.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();

Expand All @@ -26,10 +25,10 @@ void main() async {
}

class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
const MyApp({super.key});

@override
_MyAppState createState() => _MyAppState();
State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
Expand Down
6 changes: 3 additions & 3 deletions packages/protocol_handler/example/lib/pages/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import 'package:protocol_handler/protocol_handler.dart';
import 'package:window_manager/window_manager.dart';

class HomePage extends StatefulWidget {
const HomePage({Key? key}) : super(key: key);
const HomePage({super.key});

@override
_HomePageState createState() => _HomePageState();
State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> with ProtocolListener {
Expand All @@ -31,7 +31,7 @@ class _HomePageState extends State<HomePage> with ProtocolListener {
super.dispose();
}

void _init() async {
Future<void> _init() async {
_initialUrl = await protocolHandler.getInitialUrl();
setState(() {});
}
Expand Down
75 changes: 5 additions & 70 deletions packages/protocol_handler/example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,88 +1,23 @@
name: protocol_handler_example
description: Demonstrates how to use the protocol_handler plugin.

# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
publish_to: "none"

environment:
sdk: ">=2.16.1 <3.0.0"
sdk: ">=3.1.0 <4.0.0"

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
bot_toast: ^4.0.1
flutter:
sdk: flutter

preference_list: ^0.0.1
protocol_handler:
# When depending on this package from a real application you should use:
# protocol_handler: ^x.y.z
# See https://dart.dev/tools/pub/dependencies#version-constraints
# The example app is bundled with the plugin so we use a path dependency on
# the parent directory to use the current plugin's version.
path: ../

bot_toast: ^4.0.1
preference_list: ^0.0.1
window_manager: ^0.2.0

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2

dev_dependencies:
flutter_test:
sdk: flutter
mostly_reasonable_lints: ^0.1.1

# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^1.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.
flutter:

# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true

# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg

# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.

# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages

# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
23 changes: 0 additions & 23 deletions packages/protocol_handler/test/protocol_handler_test.dart

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';

import 'protocol_handler_platform_interface.dart';
import 'package:protocol_handler_platform_interface/src/protocol_handler_platform_interface.dart';

/// An implementation of [ProtocolHandlerPlatform] that uses method channels.
class MethodChannelProtocolHandler extends ProtocolHandlerPlatform {
Expand All @@ -11,7 +10,8 @@ class MethodChannelProtocolHandler extends ProtocolHandlerPlatform {

@override
Future<String?> getPlatformVersion() async {
final version = await methodChannel.invokeMethod<String>('getPlatformVersion');
final version =
await methodChannel.invokeMethod<String>('getPlatformVersion');
return version;
}
}

0 comments on commit 58e4548

Please sign in to comment.