diff --git a/ohos/path_parsing_test/.gitignore b/ohos/path_parsing_test/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..24476c5d1eb55824c76d8b01a3965f94abad1ef8 --- /dev/null +++ b/ohos/path_parsing_test/.gitignore @@ -0,0 +1,44 @@ +# 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 +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/ohos/path_parsing_test/.metadata b/ohos/path_parsing_test/.metadata new file mode 100644 index 0000000000000000000000000000000000000000..cc6478bdcf20f891a6ff5de8ceaaf40926cabf74 --- /dev/null +++ b/ohos/path_parsing_test/.metadata @@ -0,0 +1,43 @@ +# Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# 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: b041196e1cf84a3a7fd4df3d7b0a1e46a5c00a9f + channel: master + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: b041196e1cf84a3a7fd4df3d7b0a1e46a5c00a9f + base_revision: b041196e1cf84a3a7fd4df3d7b0a1e46a5c00a9f + - platform: android + create_revision: b041196e1cf84a3a7fd4df3d7b0a1e46a5c00a9f + base_revision: b041196e1cf84a3a7fd4df3d7b0a1e46a5c00a9f + + # 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' diff --git a/ohos/path_parsing_test/analysis_options.yaml b/ohos/path_parsing_test/analysis_options.yaml new file mode 100644 index 0000000000000000000000000000000000000000..61b6c4de17c96863d24279f06b85e01b6ebbdb34 --- /dev/null +++ b/ohos/path_parsing_test/analysis_options.yaml @@ -0,0 +1,29 @@ +# 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 diff --git a/ohos/path_parsing_test/lib/common/base_page.dart b/ohos/path_parsing_test/lib/common/base_page.dart new file mode 100644 index 0000000000000000000000000000000000000000..5fed43368c01dedce0246c6c1589ad53023d7d43 --- /dev/null +++ b/ohos/path_parsing_test/lib/common/base_page.dart @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import 'package:flutter/material.dart'; +import '../common/test_route.dart'; + +import '../main.dart'; +import 'main_item_widget.dart'; + +/// 全局静态数据存储 +abstract class GlobalData { + static String appName = ''; +} + +/// app基本首页 +class BasePage extends StatefulWidget { + const BasePage({super.key, required this.data}); + + final List data; + + @override + State createState() => _BasePageState(); +} + +class _BasePageState extends State { + int get _itemCount => widget.data.length; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Center(child: Text(GlobalData.appName, textAlign: TextAlign.center)), + ), + body: ListView.builder(itemBuilder: _itemBuilder, itemCount: _itemCount)); + } + + Widget _itemBuilder(BuildContext context, int index) { + return MainItemWidget(widget.data[index], (MainItem item) { + Navigator.of(context).pushNamed(item.route!); + }); + } +} diff --git a/ohos/path_parsing_test/lib/common/item_widget.dart b/ohos/path_parsing_test/lib/common/item_widget.dart new file mode 100644 index 0000000000000000000000000000000000000000..40064ef29f32abdca13979b5015fc4eb53406386 --- /dev/null +++ b/ohos/path_parsing_test/lib/common/item_widget.dart @@ -0,0 +1,138 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import '../common/test_page.dart'; + +/// Item widget. +class ItemWidget extends StatefulWidget { + /// Item widget. + const ItemWidget( + {required this.item, + required this.index, + required this.getGroupRange, + required this.runGroup, + required this.onTap, + this.summary, + Key? key}) + : super(key: key); + + /// item summary. + final String? summary; + + /// item data. + final Item item; + + /// 当前下标 + final int index; + + /// 获取对应的组信息 + final GroupRange Function() getGroupRange; + + /// 获取对应的组信息 + final void Function(int start, int end) runGroup; + + /// Action when pressed (typically run). + final void Function(Item item) onTap; + + @override + ItemWidgetState createState() => ItemWidgetState(); +} + +class ItemWidgetState extends State { + @override + Widget build(BuildContext context) { + IconData? icon; + Color? color; + + switch (widget.item.state) { + case ItemState.none: + icon = Icons.arrow_forward_ios; + break; + case ItemState.running: + icon = Icons.more_horiz; + break; + case ItemState.success: + icon = Icons.check; + color = Colors.green; + break; + case ItemState.failure: + icon = Icons.close; + color = Colors.red; + break; + } + + final Widget listTile = ListTile( + leading: SizedBox( + child: IconButton( + icon: Icon(icon, color: color), + onPressed: null, + )), + title: Text(widget.item.name), + subtitle: widget.summary != null ? Text(widget.summary!) : null, + onTap: () { + widget.onTap(widget.item); + }); + + final data = widget.getGroupRange(); + + return Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (data.groupName.isNotEmpty && data.startIndex == widget.index) + GestureDetector( + onTap: () {}, + child: Container( + height: 35, + decoration: BoxDecoration(color: CupertinoColors.extraLightBackgroundGray), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Text( + '测试组: ${data.groupName}', + style: TextStyle(fontSize: 18), + overflow: TextOverflow.ellipsis, + )), + // FilledButton( + // onPressed: () => widget.runGroup(data.startIndex, data.startIndex), + // child: Text( + // '整组测试', + // style: TextStyle(fontSize: 16), + // )) + ], + ), + ), + ), + Container( + margin: data.groupName.isNotEmpty && data.startIndex == widget.index ? EdgeInsets.only(bottom: 10) : null, + decoration: BoxDecoration( + border: data.groupName.isNotEmpty && data.endIndex == widget.index + ? Border(bottom: BorderSide(color: Colors.grey)) + : null, + ), + child: Padding( + padding: data.groupName.isNotEmpty && data.startIndex <= widget.index && data.endIndex >= widget.index + ? EdgeInsets.only(left: 35) + : EdgeInsets.zero, + child: listTile, + ), + ) + ], + ); + } +} diff --git a/ohos/path_parsing_test/lib/common/main_item_widget.dart b/ohos/path_parsing_test/lib/common/main_item_widget.dart new file mode 100644 index 0000000000000000000000000000000000000000..bad4f10d7b0a14ea8713c7ac78dabb031a72a69b --- /dev/null +++ b/ohos/path_parsing_test/lib/common/main_item_widget.dart @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import '../common/test_route.dart'; + +/// Main item widget. +class MainItemWidget extends StatefulWidget { + /// Main item widget. + const MainItemWidget(this.item, this.onTap, {Key? key}) : super(key: key); + + /// item data. + final MainItem item; + + /// onTap action (typically run or open). + final void Function(MainItem item) onTap; + + @override + MainItemWidgetState createState() => MainItemWidgetState(); +} + +class MainItemWidgetState extends State { + @override + Widget build(BuildContext context) { + return Container( + margin: const EdgeInsets.only(bottom: 10), + child: ListTile( + tileColor: CupertinoColors.extraLightBackgroundGray, + title: Text(widget.item.title), + subtitle: Text(widget.item.description), + onTap: _onTap), + ); + } + + void _onTap() { + widget.onTap(widget.item); + } +} diff --git a/ohos/path_parsing_test/lib/common/test_model_app.dart b/ohos/path_parsing_test/lib/common/test_model_app.dart new file mode 100644 index 0000000000000000000000000000000000000000..6827ec1fd81de6cddeb1c200d0d1ffecea8f89b3 --- /dev/null +++ b/ohos/path_parsing_test/lib/common/test_model_app.dart @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import 'package:flutter/material.dart'; + +import 'base_page.dart'; +import 'test_route.dart'; + +/// 基础app框架 +class TestModelApp extends StatefulWidget { + TestModelApp({super.key, required this.appName, required this.data}) { + GlobalData.appName = appName; + } + + /// 测试包名称 + final String appName; + + /// 路由数据 + final TestRoute data; + + @override + State createState() => TestModelState(); +} + +class TestModelState extends State { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: widget.appName, + theme: ThemeData( + colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue), + appBarTheme: const AppBarTheme(backgroundColor: Colors.blue), + primarySwatch: Colors.blue, + useMaterial3: true, + ), + routes: widget.data.routes, + initialRoute: '/', + ); + } +} diff --git a/ohos/path_parsing_test/lib/common/test_page.dart b/ohos/path_parsing_test/lib/common/test_page.dart new file mode 100644 index 0000000000000000000000000000000000000000..2bcb810caf34a86c5c9c2319c4ce095b419d4c0a --- /dev/null +++ b/ohos/path_parsing_test/lib/common/test_page.dart @@ -0,0 +1,316 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import 'dart:async'; + +import 'package:flutter/material.dart'; + +import 'item_widget.dart'; + +List contentList = []; + +class Test { + /// Test definition. + Test(this.name, this.fn, {bool? solo, bool? skip}) + : solo = solo == true, + skip = skip == true; + + /// Only run this test. + final bool solo; + + /// Skip this test. + final bool skip; + + /// Test name. + String name; + + /// Test body. + FutureOr Function() fn; +} + +/// Item states. +enum ItemState { + /// test not run yet. + none, + + /// test is running. + running, + + /// test succeeded. + success, + + /// test fails. + failure +} + +/// Menu item. +class Item { + /// Menu item. + Item(this.name); + + /// Menu item state. + ItemState state = ItemState.running; + + /// Menu item name/ + String name; +} + +class TestLength { + TestLength(this.oldLength, this.newLength); + + int oldLength; + int newLength; +} + +class GroupRange { + GroupRange(this.groupName, this.startIndex, this.endIndex); + + String groupName; + int startIndex; + int endIndex; +} + +/// 基础测试页面 +class TestPage extends StatefulWidget { + /// Base test page. + TestPage(this.title, {Key? key}) : super(key: key); + + /// The title. + final String title; + + /// Test list. + final List tests = []; + + /// 保存group的范围信息 + final Map groupTitle = {}; + + /// define a test. + void test(String name, FutureOr Function() fn) { + tests.add(Test(name, fn)); + } + + /// define a group test. + void group(String name, FutureOr Function() fn) { + int oldLength = tests.length; + fn(); + + int newLength = tests.length - 1; + groupTitle.addAll({name: TestLength(oldLength, newLength)}); + } + + /// Thrown an exception + void fail([String? message]) { + throw Exception(message ?? 'should fail'); + } + + @override + TestPageState createState() => TestPageState(); +} + +/// Group. +mixin Group { + /// List of tests. + List get tests { + // TODO: implement tests + throw UnimplementedError(); + } + + bool? _hasSolo; + final _tests = []; + + /// Add a test. + void add(Test test) { + if (!test.skip) { + if (test.solo) { + if (_hasSolo != true) { + _hasSolo = true; + _tests.clear(); + } + _tests.add(test); + } else if (_hasSolo != true) { + _tests.add(test); + } + } + } + + /// true if it has solo or contains item with solo feature + bool? get hasSolo => _hasSolo; +} + +class TestPageState extends State with Group { + List items = []; + + Future _run() async { + if (!mounted) { + return null; + } + + setState(() { + items.clear(); + }); + _tests.clear(); + for (var test in widget.tests) { + add(test); + } + for (var test in _tests) { + var item = Item(test.name); + contentList.add(Text(test.name, style: const TextStyle(fontSize: 18, color: Colors.green))); + + late int position; + setState(() { + position = items.length; + items.add(item); + }); + try { + await test.fn(); + item = Item(test.name)..state = ItemState.success; + print('ohFlutter: ${test.name}, result: success'); + } catch (e, st) { + contentList.add(Text('$e, $st', style: const TextStyle(fontSize: 18, color: Colors.red))); + print('ohFlutter: ${test.name}-error: $e, $st}'); + item = Item(test.name)..state = ItemState.failure; + } + + if (!mounted) { + return null; + } + + setState(() { + items[position] = item; + }); + } + } + + Future _runTest(int index) async { + if (!mounted) { + return null; + } + + final test = _tests[index]; + + var item = items[index]; + setState(() { + contentList = []; + item.state = ItemState.running; + }); + contentList.add(Text(test.name, style: const TextStyle(fontSize: 18, color: Colors.green))); + try { + await test.fn(); + + item = Item(test.name)..state = ItemState.success; + print('ohFlutter: ${test.name}, result: success'); + } catch (e, st) { + contentList.add(Text('$e, $st', style: const TextStyle(fontSize: 18, color: Colors.red))); + print('ohFlutter: ${test.name}-error: $e, $st}'); + try { + print(st); + } catch (_) {} + item = Item(test.name)..state = ItemState.failure; + } + + if (!mounted) { + return null; + } + + setState(() { + items[index] = item; + }); + } + + @override + void initState() { + super.initState(); + contentList = []; + _run(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: Text(widget.title)), + body: ListView(children: [ + ...items.asMap().keys.map((e) => _itemBuilder(context, e)).toList(), + ])); + } + + Widget _itemBuilder(BuildContext context, int index) { + final item = getItem(index); + return ItemWidget( + item: item, + index: index, + getGroupRange: () { + GroupRange data = GroupRange('', 0, 0); + widget.groupTitle.forEach((key, value) { + if (value.oldLength <= index && value.newLength >= index) { + data = GroupRange(key, value.oldLength, value.newLength); + } + }); + return data; + }, + runGroup: (start, end) async { + for (var i = start; i <= end; i++) { + await _runTest(i); + print('\n'); + } + }, + onTap: (Item item) { + _runTest(index); + showAlertDialog(context); + }); + } + + Item getItem(int index) { + return items[index]; + } + + @override + List get tests => widget.tests; +} + +void expect(var testModel, var object) { + try { + testModel; + contentList.add(Text(testModel.toString())); + } catch (e) { + contentList.add(Text( + '$e', + style: const TextStyle(color: Colors.red), + )); + print(e.toString()); + } +} + +void showAlertDialog(BuildContext context) { + showDialog( + context: context, + barrierDismissible: false, + builder: (BuildContext context) { + return AlertDialog( + content: SingleChildScrollView( + child: Column( + children: contentList, + ), + ), + actions: [ + MaterialButton( + child: const Text('确定'), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + ); + }); +} diff --git a/ohos/path_parsing_test/lib/common/test_route.dart b/ohos/path_parsing_test/lib/common/test_route.dart new file mode 100644 index 0000000000000000000000000000000000000000..f8c2adac0460438679d9a3e4a1fa55febc0d19c1 --- /dev/null +++ b/ohos/path_parsing_test/lib/common/test_route.dart @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import 'package:flutter/cupertino.dart'; + +import 'base_page.dart'; + +class MainItem { + /// Main item. + MainItem(this.title, this.description, {this.route}); + + /// Title. + String title; + + /// Description. + String description; + + /// Page route. + String? route; +} + +class TestRoute { + TestRoute({required Map routes, required this.items}) { + if (routes.containsKey('/')) { + throw Exception('不允许传入 / 路由'); + } + + this.routes.addAll({ + '/': (BuildContext context) => BasePage(data: items), + }); + this.routes.addAll(routes); + } + + Map routes = {}; + + List items = []; +} diff --git a/ohos/path_parsing_test/lib/main.dart b/ohos/path_parsing_test/lib/main.dart new file mode 100644 index 0000000000000000000000000000000000000000..fce7e4cea86a13dc600ea180068bd0697ac4228d --- /dev/null +++ b/ohos/path_parsing_test/lib/main.dart @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import 'package:flutter/cupertino.dart'; + +import 'common/test_model_app.dart'; +import 'common/test_route.dart'; +import 'pages/example.dart'; +import 'pages/function_list.dart'; +import 'pages/parse_path_deep_test.dart'; + +void main() { + final items = [ + MainItem('functions', "", route: "FunctionList"), + + //SSvgPathStringSourceTestPage + MainItem('parse_path_deep_test', "", route: "ParsePathDeepTestPage"), + MainItem('parse_path_test', "", route: "ParsePathTestPage"), + ]; + + runApp(TestModelApp( + appName: 'parse_path', + data: TestRoute( + items: items, + routes: { + "FunctionList": (context) { + return FunctionList(); + }, + //SSvgPathStringSourceTestPage + "ParsePathDeepTestPage": (context) { + return ParsePathDeepTestPage("ParsePathDeepTestPage"); + }, + }, + //PathParsingExamp + ))); //BuilderTestPage +} diff --git a/ohos/path_parsing_test/lib/pages/example.dart b/ohos/path_parsing_test/lib/pages/example.dart new file mode 100644 index 0000000000000000000000000000000000000000..992c1223883844d76e4a02ae5f9cb9e18de5a9a2 --- /dev/null +++ b/ohos/path_parsing_test/lib/pages/example.dart @@ -0,0 +1,193 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import 'package:flutter/material.dart'; +import 'package:path_parsing/path_parsing.dart'; + +class PathParsingPage extends StatelessWidget { + const PathParsingPage({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('Path Parsing Example'), + ), + body: Center( + child: CustomPaint( + size: const Size(40, 40), + painter: TopDecoration(context), + ), + ), + ); + } +} + +class PathPrinter extends PathProxy { + Path path = Path(); + @override + void close() { + path.close(); + } + + @override + void moveTo(double x, double y) { + path.moveTo(x, y); + } + + @override + void cubicTo(double x1, double y1, double x2, double y2, double x3, double y3) { + path.cubicTo(x1, y1, x2, y2, x3, y3); + } + + @override + void lineTo(double x, double y) { + path.lineTo(x, y); + } +} + +class TopDecoration extends CustomPainter { + final BuildContext context; + TopDecoration(this.context); + + void showAlertDialog(BuildContext context, String text) { + showDialog( + context: context, + barrierDismissible: false, + builder: (BuildContext context) { + return AlertDialog( + content: SingleChildScrollView( + child: Column( + children: [ + Text( + text, + maxLines: 100, + overflow: TextOverflow.ellipsis, + ) + ], + ), + ), + actions: [ + MaterialButton( + child: const Text('确定'), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + ); + }); + } + + @override + void paint(Canvas canvas, Size size) { + final paint = Paint() + ..color = Colors.blue + ..style = PaintingStyle.stroke + ..strokeWidth = 2.0; + PathPrinter path = PathPrinter(); + + const String pathData = 'M22.1595 3.80852C19.6789 1.35254 16.3807 -4.80966e-07 12.8727 ' + '-4.80966e-07C9.36452 -4.80966e-07 6.06642 1.35254 3.58579 ' + '3.80852C1.77297 5.60333 0.53896 7.8599 0.0171889 10.3343C-0.0738999 ' + '10.7666 0.206109 11.1901 0.64265 11.2803C1.07908 11.3706 1.50711 11.0934 ' + '1.5982 10.661C2.05552 8.49195 3.13775 6.51338 4.72783 4.9391C9.21893 ' + '0.492838 16.5262 0.492728 21.0173 4.9391C25.5082 9.38548 25.5082 16.6202 ' + '21.0173 21.0667C16.5265 25.5132 9.21893 25.5133 4.72805 21.0669C3.17644 ' + '19.5307 2.10538 17.6035 1.63081 15.4937C1.53386 15.0627 1.10252 14.7908 ' + '0.66697 14.887C0.231645 14.983 -0.0427272 15.4103 0.0542205 ' + '15.8413C0.595668 18.2481 1.81686 20.4461 3.5859 22.1976C6.14623 ' + '24.7325 9.50955 26 12.8727 26C16.236 26 19.5991 24.7326 22.1595 ' + '22.1976C27.2802 17.1277 27.2802 8.87841 22.1595 3.80852Z'; + + // const String pathData = 'M50 0 Q70 20, 50 40, Q30 20, 50 0 M50 0 Q70 -20, 50 -40, Q30 -20, 50 0 M50 40 V100'; + // const String pathData = 'M7.6,7C0.4'; + try { + writeSvgPathDataToPath(pathData, path); + canvas.drawPath(path.path, paint); + } catch (e) { + print('路径错误:${e.toString()}'); + // CustomDialog(title: '发生错误', message: e.toString()); + } + } + + @override + bool shouldRepaint(CustomPainter oldDelegate) { + // TODO: implement shouldRepaint + return false; + } +} + +class CustomDialog extends StatelessWidget { + final String title; + final String message; + + CustomDialog({required this.title, required this.message}); + + @override + Widget build(BuildContext context) { + return Dialog( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16), + ), + elevation: 0, + backgroundColor: Colors.transparent, + child: _buildDialogContent(context), + ); + } + + Widget _buildDialogContent(BuildContext context) { + return Container( + padding: EdgeInsets.all(16), + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black26, + blurRadius: 10.0, + offset: const Offset(0.0, 10.0), + ), + ], + ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + title, + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(height: 16), + Text( + message, + style: TextStyle(fontSize: 16), + textAlign: TextAlign.center, + ), + SizedBox(height: 24), + ElevatedButton( + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text('关闭'), + ), + ], + ), + ); + } +} diff --git a/ohos/path_parsing_test/lib/pages/function_list.dart b/ohos/path_parsing_test/lib/pages/function_list.dart new file mode 100644 index 0000000000000000000000000000000000000000..d9015f16b716d96c455c02a2967d811408826033 --- /dev/null +++ b/ohos/path_parsing_test/lib/pages/function_list.dart @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import 'package:flutter/material.dart'; + +import 'example.dart'; + +class FunctionList extends StatelessWidget { + final functionList = ["解析和处理SVG路径数据"]; + final pages = [ + PathParsingPage(), + ]; + + FunctionList({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('path_parsing功能演示'), + ), + body: ListView.builder( + itemCount: functionList.length, + itemBuilder: (context, index) { + return GestureDetector( + onTap: () { + Navigator.push(context, MaterialPageRoute(builder: (_) { + return pages[index]; + })); + }, + child: ListTile( + title: Text(functionList[index]), + ), + ); + }, + ), + ); + } +} diff --git a/ohos/path_parsing_test/lib/pages/parse_path_deep_test.dart b/ohos/path_parsing_test/lib/pages/parse_path_deep_test.dart new file mode 100644 index 0000000000000000000000000000000000000000..f5a16bb0e3a338eb602f86f439f2ec59efe9a3df --- /dev/null +++ b/ohos/path_parsing_test/lib/pages/parse_path_deep_test.dart @@ -0,0 +1,105 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import 'package:flutter/cupertino.dart'; +import 'package:path_parsing/path_parsing.dart'; + +import '../common/test_page.dart'; + +class DeepTestPathProxy extends PathProxy { + DeepTestPathProxy(this.expectedCommands); + + final List expectedCommands; + final List actualCommands = []; + + @override + void close() { + actualCommands.add('close()'); + } + + @override + void cubicTo( + double x1, + double y1, + double x2, + double y2, + double x3, + double y3, + ) { + actualCommands.add( + 'cubicTo(${x1.toStringAsFixed(4)}, ${y1.toStringAsFixed(4)}, ${x2.toStringAsFixed(4)}, ${y2.toStringAsFixed(4)}, ${x3.toStringAsFixed(4)}, ${y3.toStringAsFixed(4)})'); + } + + @override + void lineTo(double x, double y) { + actualCommands.add('lineTo(${x.toStringAsFixed(4)}, ${y.toStringAsFixed(4)})'); + } + + @override + void moveTo(double x, double y) { + actualCommands.add('moveTo(${x.toStringAsFixed(4)}, ${y.toStringAsFixed(4)})'); + } + + void validate() { + expect(areArraysEqual(expectedCommands, actualCommands), null); + expect(expectedCommands, null); + expect("---------------------", null); + expect(actualCommands, null); + } + + bool areArraysEqual(List array1, List array2) { + if (array1.length != array2.length) { + return false; + } + array1.sort(); + array2.sort(); + + for (int i = 0; i < array1.length; i++) { + if (array1[i] != array2[i]) { + return false; + } + } + return true; + } +} + +class ParsePathDeepTestPage extends TestPage { + ParsePathDeepTestPage(String title, {Key? key}) : super(title, key: key) { + void assertValidPath(String input, List commands) { + final DeepTestPathProxy proxy = DeepTestPathProxy(commands); + writeSvgPathDataToPath(input, proxy); + proxy.validate(); + } + + test('Deep path validation', () { + assertValidPath('M20,30 Q40,5 60,30 T100,30', [ + 'moveTo(20.0000, 30.0000)', + 'cubicTo(33.3333, 13.3333, 46.6667, 13.3333, 60.0000, 30.0000)', + 'cubicTo(73.3333, 46.6667, 86.6667, 46.6667, 100.0000, 30.0000)' + ]); + + assertValidPath('M5.5 5.5a.5 1.5 30 1 1-.866-.5.5 1.5 30 1 1 .866.5z', [ + 'moveTo(5.5000, 5.5000)', + 'cubicTo(5.2319, 5.9667, 4.9001, 6.3513, 4.6307, 6.5077)', + 'cubicTo(4.3612, 6.6640, 4.1953, 6.5683, 4.1960, 6.2567)', + 'cubicTo(4.1967, 5.9451, 4.3638, 5.4655, 4.6340, 5.0000)', + 'cubicTo(4.9021, 4.5333, 5.2339, 4.1487, 5.5033, 3.9923)', + 'cubicTo(5.7728, 3.8360, 5.9387, 3.9317, 5.9380, 4.2433)', + 'cubicTo(5.9373, 4.5549, 5.7702, 5.0345, 5.5000, 5.5000)', + 'close()' + ]); + }); + } +} diff --git a/ohos/path_parsing_test/ohos/.gitignore b/ohos/path_parsing_test/ohos/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..6ca13b3170eec5dd5ac5ad7f1c4dd0118845f473 --- /dev/null +++ b/ohos/path_parsing_test/ohos/.gitignore @@ -0,0 +1,19 @@ +/node_modules +/oh_modules +/local.properties +/.idea +**/build +/.hvigor +.cxx +/.clangd +/.clang-format +/.clang-tidy +**/.test +*.har +**/BuildProfile.ets +**/oh-package-lock.json5 + +**/src/main/resources/rawfile/flutter_assets/ +**/libs/arm64-v8a/libapp.so +**/libs/arm64-v8a/libflutter.so +**/libs/arm64-v8a/libvmservice_snapshot.so diff --git a/ohos/path_parsing_test/ohos/AppScope/app.json5 b/ohos/path_parsing_test/ohos/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..a1c9fdadce46d017fe0027822f17dbdb18c66c11 --- /dev/null +++ b/ohos/path_parsing_test/ohos/AppScope/app.json5 @@ -0,0 +1,10 @@ +{ + "app": { + "bundleName": "com.example.path_parsing_test", + "vendor": "example", + "versionCode": 1, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name" + } +} \ No newline at end of file diff --git a/ohos/path_parsing_test/ohos/AppScope/resources/base/element/string.json b/ohos/path_parsing_test/ohos/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..07759fa37916781561f2e4a4ca3667c0e35f0639 --- /dev/null +++ b/ohos/path_parsing_test/ohos/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "path_parsing_test" + } + ] +} diff --git a/ohos/path_parsing_test/ohos/AppScope/resources/base/media/app_icon.png b/ohos/path_parsing_test/ohos/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ohos/path_parsing_test/ohos/AppScope/resources/base/media/app_icon.png differ diff --git a/ohos/path_parsing_test/ohos/build-profile.json5 b/ohos/path_parsing_test/ohos/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..0d8b167e6cea7b597c49097ab38d3e9ff785a24f --- /dev/null +++ b/ohos/path_parsing_test/ohos/build-profile.json5 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "app": { + "signingConfigs": [], + "products": [ + { + "name": "default", + "signingConfig": "default", + "compatibleSdkVersion": "5.0.0(12)", + "runtimeOS": "HarmonyOS", + } + ] + }, + "modules": [ + { + "name": "entry", + "srcPath": "./entry", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/ohos/path_parsing_test/ohos/entry/.gitignore b/ohos/path_parsing_test/ohos/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..2795a1c5b1fe53659dd1b71d90ba0592eaf7e043 --- /dev/null +++ b/ohos/path_parsing_test/ohos/entry/.gitignore @@ -0,0 +1,7 @@ + +/node_modules +/oh_modules +/.preview +/build +/.cxx +/.test \ No newline at end of file diff --git a/ohos/path_parsing_test/ohos/entry/build-profile.json5 b/ohos/path_parsing_test/ohos/entry/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..633d360fbc91a3186a23b66ab71b27e5618944cb --- /dev/null +++ b/ohos/path_parsing_test/ohos/entry/build-profile.json5 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "apiType": 'stageMode', + "buildOption": { + }, + "targets": [ + { + "name": "default", + "runtimeOS": "HarmonyOS" + }, + { + "name": "ohosTest", + } + ] +} \ No newline at end of file diff --git a/ohos/path_parsing_test/ohos/entry/hvigorfile.ts b/ohos/path_parsing_test/ohos/entry/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..894fc15c6b793f085e6c8506e43d719af658e8ff --- /dev/null +++ b/ohos/path_parsing_test/ohos/entry/hvigorfile.ts @@ -0,0 +1,17 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. +export { hapTasks } from '@ohos/hvigor-ohos-plugin'; diff --git a/ohos/path_parsing_test/ohos/entry/oh-package.json5 b/ohos/path_parsing_test/ohos/entry/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..803b25293388deda7b9a05a21b5aeadeb716b4d5 --- /dev/null +++ b/ohos/path_parsing_test/ohos/entry/oh-package.json5 @@ -0,0 +1,9 @@ +{ + "name": "entry", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": {} +} \ No newline at end of file diff --git a/ohos/path_parsing_test/ohos/entry/src/main/ets/entryability/EntryAbility.ets b/ohos/path_parsing_test/ohos/entry/src/main/ets/entryability/EntryAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..8bc48be8773196f34cccb15cf517f87f5c6b94d2 --- /dev/null +++ b/ohos/path_parsing_test/ohos/entry/src/main/ets/entryability/EntryAbility.ets @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { FlutterAbility, FlutterEngine } from '@ohos/flutter_ohos'; +import { GeneratedPluginRegistrant } from '../plugins/GeneratedPluginRegistrant'; + +export default class EntryAbility extends FlutterAbility { + configureFlutterEngine(flutterEngine: FlutterEngine) { + super.configureFlutterEngine(flutterEngine) + GeneratedPluginRegistrant.registerWith(flutterEngine) + } +} diff --git a/ohos/path_parsing_test/ohos/entry/src/main/ets/pages/Index.ets b/ohos/path_parsing_test/ohos/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..1125f9fdd95f4310a182c1c9e3680f37f73686c9 --- /dev/null +++ b/ohos/path_parsing_test/ohos/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import common from '@ohos.app.ability.common'; +import { FlutterPage } from '@ohos/flutter_ohos' + +let storage = LocalStorage.getShared() +const EVENT_BACK_PRESS = 'EVENT_BACK_PRESS' + +@Entry(storage) +@Component +struct Index { + private context = getContext(this) as common.UIAbilityContext + @LocalStorageLink('viewId') viewId: string = ""; + + build() { + Column() { + FlutterPage({ viewId: this.viewId }) + } + } + + onBackPress(): boolean { + this.context.eventHub.emit(EVENT_BACK_PRESS) + return true + } +} \ No newline at end of file diff --git a/ohos/path_parsing_test/ohos/entry/src/main/module.json5 b/ohos/path_parsing_test/ohos/entry/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7bbf78b18f39991b1404061c7437538c7d532bb7 --- /dev/null +++ b/ohos/path_parsing_test/ohos/entry/src/main/module.json5 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ets", + "description": "$string:EntryAbility_desc", + "icon": "$media:icon", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "requestPermissions": [ + {"name" : "ohos.permission.INTERNET"}, + ] + } +} \ No newline at end of file diff --git a/ohos/path_parsing_test/ohos/entry/src/main/resources/base/element/color.json b/ohos/path_parsing_test/ohos/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/ohos/path_parsing_test/ohos/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ohos/path_parsing_test/ohos/entry/src/main/resources/base/element/string.json b/ohos/path_parsing_test/ohos/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d2804bd038cdfd6d969bcc2f0345b8ccbd18652b --- /dev/null +++ b/ohos/path_parsing_test/ohos/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "path_parsing_test" + } + ] +} \ No newline at end of file diff --git a/ohos/path_parsing_test/ohos/entry/src/main/resources/base/media/icon.png b/ohos/path_parsing_test/ohos/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ohos/path_parsing_test/ohos/entry/src/main/resources/base/media/icon.png differ diff --git a/ohos/path_parsing_test/ohos/entry/src/main/resources/base/profile/main_pages.json b/ohos/path_parsing_test/ohos/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/ohos/path_parsing_test/ohos/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/ohos/path_parsing_test/ohos/entry/src/main/resources/en_US/element/string.json b/ohos/path_parsing_test/ohos/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d2804bd038cdfd6d969bcc2f0345b8ccbd18652b --- /dev/null +++ b/ohos/path_parsing_test/ohos/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "path_parsing_test" + } + ] +} \ No newline at end of file diff --git a/ohos/path_parsing_test/ohos/entry/src/main/resources/zh_CN/element/string.json b/ohos/path_parsing_test/ohos/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..a82f4698577a0b3446c6eded28a27bd5f737e254 --- /dev/null +++ b/ohos/path_parsing_test/ohos/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "path_parsing_test" + } + ] +} \ No newline at end of file diff --git a/ohos/path_parsing_test/ohos/entry/src/ohosTest/ets/test/Ability.test.ets b/ohos/path_parsing_test/ohos/entry/src/ohosTest/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..25d4c71ff3cd584f5d64f6f8c0ac864928c234c4 --- /dev/null +++ b/ohos/path_parsing_test/ohos/entry/src/ohosTest/ets/test/Ability.test.ets @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import hilog from '@ohos.hilog'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +export default function abilityTest() { + describe('ActsAbilityTest', function () { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(function () { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(function () { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }) + afterEach(function () { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(function () { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + it('assertContain',0, function () { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + hilog.info(0x0000, 'testTag', '%{public}s', 'it begin'); + let a = 'abc' + let b = 'b' + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b) + expect(a).assertEqual(a) + }) + }) +} \ No newline at end of file diff --git a/ohos/path_parsing_test/ohos/entry/src/ohosTest/ets/test/List.test.ets b/ohos/path_parsing_test/ohos/entry/src/ohosTest/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f4140030e65d20df6af30a6bf51e464dea8f8aa6 --- /dev/null +++ b/ohos/path_parsing_test/ohos/entry/src/ohosTest/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import abilityTest from './Ability.test' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/ohos/path_parsing_test/ohos/entry/src/ohosTest/ets/testability/TestAbility.ets b/ohos/path_parsing_test/ohos/entry/src/ohosTest/ets/testability/TestAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..4ca645e6013cfce8e7dbb728313cb8840c4da660 --- /dev/null +++ b/ohos/path_parsing_test/ohos/entry/src/ohosTest/ets/testability/TestAbility.ets @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import UIAbility from '@ohos.app.ability.UIAbility'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; +import hilog from '@ohos.hilog'; +import { Hypium } from '@ohos/hypium'; +import testsuite from '../test/List.test'; +import window from '@ohos.window'; + +export default class TestAbility extends UIAbility { + onCreate(want, launchParam) { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); + hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); + hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage) { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); + windowStage.loadContent('testability/pages/Index', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', + JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); + } + + onForeground() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); + } + + onBackground() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); + } +} \ No newline at end of file diff --git a/ohos/path_parsing_test/ohos/entry/src/ohosTest/ets/testability/pages/Index.ets b/ohos/path_parsing_test/ohos/entry/src/ohosTest/ets/testability/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..cef0447cd2f137ef82d223ead2e156808878ab90 --- /dev/null +++ b/ohos/path_parsing_test/ohos/entry/src/ohosTest/ets/testability/pages/Index.ets @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import hilog from '@ohos.hilog'; + +@Entry +@Component +struct Index { + aboutToAppear() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ohos/path_parsing_test/ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts b/ohos/path_parsing_test/ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..1def08f2e9dcbfa3454a07b7a3b82b173bb90d02 --- /dev/null +++ b/ohos/path_parsing_test/ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import hilog from '@ohos.hilog'; +import TestRunner from '@ohos.application.testRunner'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +async function onAbilityCreateCallback() { + hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err: any) { + hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); + } + + async onRun() { + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName + var debug = abilityDelegatorArguments.parameters['-D'] + if (debug == 'true') + { + cmd += ' -D' + } + hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); + }) + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); + } +} \ No newline at end of file diff --git a/ohos/path_parsing_test/ohos/entry/src/ohosTest/module.json5 b/ohos/path_parsing_test/ohos/entry/src/ohosTest/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..fab77ce2e0c61e3ad010bab5b27ccbd15f9a8c96 --- /dev/null +++ b/ohos/path_parsing_test/ohos/entry/src/ohosTest/module.json5 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "module": { + "name": "entry_test", + "type": "feature", + "description": "$string:module_test_desc", + "mainElement": "TestAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:test_pages", + "abilities": [ + { + "name": "TestAbility", + "srcEntry": "./ets/testability/TestAbility.ets", + "description": "$string:TestAbility_desc", + "icon": "$media:icon", + "label": "$string:TestAbility_label", + "exported": true, + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + } + ] + } +} diff --git a/ohos/path_parsing_test/ohos/entry/src/ohosTest/resources/base/element/color.json b/ohos/path_parsing_test/ohos/entry/src/ohosTest/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/ohos/path_parsing_test/ohos/entry/src/ohosTest/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ohos/path_parsing_test/ohos/entry/src/ohosTest/resources/base/element/string.json b/ohos/path_parsing_test/ohos/entry/src/ohosTest/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c --- /dev/null +++ b/ohos/path_parsing_test/ohos/entry/src/ohosTest/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_test_desc", + "value": "test ability description" + }, + { + "name": "TestAbility_desc", + "value": "the test ability" + }, + { + "name": "TestAbility_label", + "value": "test label" + } + ] +} \ No newline at end of file diff --git a/ohos/path_parsing_test/ohos/entry/src/ohosTest/resources/base/media/icon.png b/ohos/path_parsing_test/ohos/entry/src/ohosTest/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ohos/path_parsing_test/ohos/entry/src/ohosTest/resources/base/media/icon.png differ diff --git a/ohos/path_parsing_test/ohos/entry/src/ohosTest/resources/base/profile/test_pages.json b/ohos/path_parsing_test/ohos/entry/src/ohosTest/resources/base/profile/test_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..b7e7343cacb32ce982a45e76daad86e435e054fe --- /dev/null +++ b/ohos/path_parsing_test/ohos/entry/src/ohosTest/resources/base/profile/test_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "testability/pages/Index" + ] +} diff --git a/ohos/path_parsing_test/ohos/hvigor/hvigor-config.json5 b/ohos/path_parsing_test/ohos/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..541ba35711b75986f9295410ee38fdb8f2572878 --- /dev/null +++ b/ohos/path_parsing_test/ohos/hvigor/hvigor-config.json5 @@ -0,0 +1,20 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "modelVersion": "5.0.0", + "dependencies": { + } +} \ No newline at end of file diff --git a/ohos/path_parsing_test/ohos/hvigorfile.ts b/ohos/path_parsing_test/ohos/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..8f2d2aafe6d6a3a71a9944ebd0c91fbc308ac9d1 --- /dev/null +++ b/ohos/path_parsing_test/ohos/hvigorfile.ts @@ -0,0 +1,21 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { appTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} \ No newline at end of file diff --git a/ohos/path_parsing_test/ohos/oh-package.json5 b/ohos/path_parsing_test/ohos/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..81f3e5f12a3aa1cf5c707436d00bbf08ba4e5c7d --- /dev/null +++ b/ohos/path_parsing_test/ohos/oh-package.json5 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "modelVersion": "5.0.0", + "name": "path_parsing_test", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": { + "@ohos/flutter_ohos": "file:./har/flutter.har" + }, + "devDependencies": { + "@ohos/hypium": "1.0.6" + }, + "overrides": { + "@ohos/flutter_ohos": "file:./har/flutter.har" + } +} diff --git a/ohos/path_parsing_test/pubspec.yaml b/ohos/path_parsing_test/pubspec.yaml new file mode 100644 index 0000000000000000000000000000000000000000..5306193b8e573a262861ac4ab49e430d96b67f52 --- /dev/null +++ b/ohos/path_parsing_test/pubspec.yaml @@ -0,0 +1,93 @@ +name: lz_path_parsing_test +description: A new Flutter project. +# 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 + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# In Windows, build-name is used as the major, minor, and patch parts +# of the product and file versions while build-number is used as the build suffix. +version: 1.0.0+1 + +environment: + sdk: '>=2.19.6 <3.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: + flutter: + sdk: flutter + + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.2 + path_parsing: ^1.0.1 + +dev_dependencies: + flutter_test: + sdk: flutter + path: ^1.8.0 + test: ^1.16.0 + + # 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: ^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: + + # 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