Коммит 3469f4ff создал по автору Красавин Никита Сергеевич's avatar Красавин Никита Сергеевич
Просмотр файлов

move from flutter-plugins repo

владелец 1234450d
# 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/
.flutter-plugins
.flutter-plugins-dependencies
## Updated: 05/29/2024 17:26:26 PM
## Info
- Last tag: internal_aurora-0.5.0
- Released: 1
## Versions
- Version: internal_aurora-0.5.0 (24/04/2024)
# internal_aurora
A package to simplify and organize plugins example.
## Features
- `ListSeparated` - the basic component for building the page.
- `ListItemInfo` - a block with information about the plugin that every example should have.
- `ListItemData` - a list element that can process feature & stream, value values.
- `ListButton` - button stylized as examples.
- `AppBarAction` - stylized AppBar.
- `ListItemInfoSuccess` - a stylized block for forms displaying success.
- `ListItemInfoError` - a stylized block for forms displaying error.
- `InternalColors` - Standard colors for examples, with an expanded set.
**pubspec.yaml**
```yaml
dependencies:
internal_aurora:
git:
url: https://gitlab.com/omprussia/flutter/flutter-plugins.git
ref: internal_aurora-0.5.1
path: packages/internal_aurora
```
***.dart**
```dart
MaterialApp(
// Common theme for examples
theme: internalTheme,
home: Scaffold(
appBar: AppBar(
// Title
title: const Text('Internal'),
// Add button for refresh data.
actions: [AppBarAction(onPressed: _init)],
),
// Custom list for widgets with separated.
body: ListSeparated(
children: [
// The plugin must have a description in the example.
const ListItemInfo("""
This is an example implementation of the example for the plugin.
"""),
// We have a data block in which we can display
// information in the formats: stream, future, value.
ListItemData(
'Check Aurora OS',
InternalColors.purple,
description: 'Displays whether the current system is Aurora OS',
widthData: 140,
stream: _impl.onIsAurora(),
builder: (value) => value?.toString().toUpperCase(),
),
// Custom widget in ListItemData
ListItemData('Check Aurora OS', InternalColors.orange,
description: """
Displays whether the current system is Aurora OS
with custom widget
""",
widthData: 140,
stream: _impl.onIsAurora(), builder: (value) {
final boxDecoration = BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(30.0),
);
switch (value) {
case true:
return Container(
decoration: boxDecoration,
padding: const EdgeInsets.all(8),
child: const Icon(
Icons.verified,
color: Colors.green,
),
);
case false:
return Container(
decoration: boxDecoration,
padding: const EdgeInsets.all(8),
child: const Icon(
Icons.new_releases,
color: Colors.red,
),
);
default:
return Container(
decoration: boxDecoration,
padding: const EdgeInsets.all(8),
child: const Icon(
Icons.hourglass_bottom,
color: Colors.blueGrey,
),
);
}
}),
// We will demonstrate how the refresh feature works
ListItemData(
'Random number',
InternalColors.coal,
description: 'This random number should be updated after refresh',
// If you do not specify the size, the data block will be displayed as a list
widthData: null,
future: _randomNumber,
builder: (value) => value?.toString().toUpperCase(),
),
// Button in common style for example
ListButton('Refresh', InternalColors.green, onPressed: _init)
],
),
),
);
```
# SPDX-FileCopyrightText: Copyright 2023 Open Mobile Platform LLC <community@omp.ru>
# SPDX-License-Identifier: BSD-3-Clause
include: package:flutter_lints/flutter.yaml
## Application configuration file Changeln
## Version config: 0.0.2
## Comment tags by which they will be searched
## and groups by which they will be analyzed.
commits:
Bug: '[internal_aurora][bug]'
Change: '[internal_aurora][change]'
Feature: '[internal_aurora][feature]'
## Path to mako template
template: ../../.changeln/changeln.mako
## Regular expression to break the comment into groups
## to format the comment output in the changelog in the
## "regex" variable.
##
## The empty value is not used.
parse: ''
## Filter tags using regular expressions
##
## The empty value is not used.
filter: '^((?!internal_aurora).)*$'
# 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
.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
# Aurora generated
/aurora/flutter
# Internal aurora example
Demonstrates how to use the `internal_aurora` plugin.
## Usage
Get dependency
```shell
flutter-aurora pub get
```
Build aurora application
```shell
flutter-aurora build aurora --release
```
# SPDX-FileCopyrightText: Copyright 2024 Open Mobile Platform LLC <community@omp.ru>
# SPDX-License-Identifier: BSD-3-Clause
include: package:flutter_lints/flutter.yaml
# SPDX-FileCopyrightText: Copyright 2024 Open Mobile Platform LLC <community@omp.ru>
# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.10)
project(ru.auroraos.internal_example LANGUAGES CXX)
include(GNUInstallDirs)
set(BINARY_NAME ${CMAKE_PROJECT_NAME})
set(FLUTTER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/flutter)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_SKIP_RPATH OFF)
set(CMAKE_INSTALL_RPATH "\$ORIGIN/../share/${BINARY_NAME}/lib")
find_package(PkgConfig REQUIRED)
pkg_check_modules(FlutterEmbedder REQUIRED IMPORTED_TARGET flutter-embedder)
add_executable(${BINARY_NAME} main.cpp ${FLUTTER_DIR}/generated_plugin_registrant.cpp)
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::FlutterEmbedder)
target_include_directories(${BINARY_NAME} PRIVATE ${FLUTTER_DIR})
include(flutter/generated_plugins.cmake)
set(PACKAGE_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/${BINARY_NAME})
set(DESKTOP_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/applications)
set(ICONS_INSTALL_ROOT_DIR ${CMAKE_INSTALL_DATADIR}/icons/hicolor)
add_custom_command(TARGET ${BINARY_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libflutter-embedder.so
${PROJECT_BINARY_DIR}/bundle/lib/libflutter-embedder.so)
install(FILES ${PROJECT_BINARY_DIR}/bundle/icudtl.dat DESTINATION ${PACKAGE_INSTALL_DIR})
install(DIRECTORY ${PROJECT_BINARY_DIR}/bundle/flutter_assets DESTINATION ${PACKAGE_INSTALL_DIR})
install(DIRECTORY ${PROJECT_BINARY_DIR}/bundle/lib DESTINATION ${PACKAGE_INSTALL_DIR})
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES desktop/${BINARY_NAME}.desktop DESTINATION ${DESKTOP_INSTALL_DIR})
foreach(ICONS_SIZE 86x86 108x108 128x128 172x172)
install(FILES icons/${ICONS_SIZE}.png
RENAME ${BINARY_NAME}.png
DESTINATION ${ICONS_INSTALL_ROOT_DIR}/${ICONS_SIZE}/apps/)
endforeach(ICONS_SIZE)
[Desktop Entry]
Type=Application
Name=Internal
Comment=The Aurora OS example of internal package.
Icon=ru.auroraos.internal_example
Exec=/usr/bin/ru.auroraos.internal_example
X-Nemo-Application-Type=silica-qt5
[X-Application]
Permissions=
OrganizationName=ru.auroraos
ApplicationName=internal_example
/**
* SPDX-FileCopyrightText: Copyright 2024 Open Mobile Platform LLC <community@omp.ru>
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <flutter/flutter_aurora.h>
#include "generated_plugin_registrant.h"
int main(int argc, char* argv[]) {
aurora::Initialize(argc, argv);
aurora::RegisterPlugins();
aurora::Launch();
return 0;
}
%global __provides_exclude_from ^%{_datadir}/%{name}/lib/.*$
%global __requires_exclude ^lib(dconf|flutter-embedder|maliit-glib|.+_platform_plugin)\\.so.*$
Name: ru.auroraos.internal_example
Summary: The Aurora OS example of internal package.
Version: 0.1.0
Release: 1
License: BSD 3-Clause
Source0: %{name}-%{version}.tar.zst
BuildRequires: cmake
BuildRequires: ninja
%description
%{summary}.
%prep
%autosetup
%build
%cmake -GNinja -DCMAKE_BUILD_TYPE=%{_flutter_build_type} -DPSDK_VERSION=%{_flutter_psdk_version} -DPSDK_MAJOR=%{_flutter_psdk_major}
%ninja_build
%install
%ninja_install
%files
%{_bindir}/%{name}
%{_datadir}/%{name}/*
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.png
// SPDX-FileCopyrightText: Copyright 2024 Open Mobile Platform LLC <community@omp.ru>
// SPDX-License-Identifier: BSD-3-Clause
import 'package:flutter/material.dart';
import 'package:internal_aurora/abb_bar_action.dart';
import 'package:internal_aurora/list_button.dart';
import 'package:internal_aurora/list_item_data.dart';
import 'package:internal_aurora/list_item_info.dart';
import 'package:internal_aurora/list_separated.dart';
import 'package:internal_aurora/theme/colors.dart';
import 'package:internal_aurora/theme/theme.dart';
import 'plugin_impl.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
// All functionality is included in the *impl class
// and the methods have a description.
final PluginImpl _impl = PluginImpl();
// Future data with for demonstration refresh logic
late Future<int> _randomNumber;
@override
void initState() {
_init();
super.initState();
}
/// The method should not change its name for standardization
Future<void> _init() async {
if (!mounted) return;
setState(() {
_randomNumber = _impl.getNumber();
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
// Common theme for examples
theme: internalTheme,
home: Scaffold(
appBar: AppBar(
// Title
title: const Text('Internal'),
// Add button for refresh data.
actions: [AppBarAction(onPressed: _init)],
),
// Custom list for widgets with separated.
body: ListSeparated(
children: [
// The plugin must have a description in the example.
const ListItemInfo("""
This is an example implementation of the example for the plugin.
"""),
// We have a data block in which we can display
// information in the formats: stream, future, value.
ListItemData(
'Check Aurora OS',
InternalColors.purple,
description: 'Displays whether the current system is Aurora OS',
widthData: 140,
stream: _impl.onIsAurora(),
builder: (value) => value?.toString().toUpperCase(),
),
// Custom widget in ListItemData
ListItemData('Check Aurora OS', InternalColors.orange,
description: """
Displays whether the current system is Aurora OS
with custom widget
""",
widthData: 140,
stream: _impl.onIsAurora(), builder: (value) {
final boxDecoration = BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(30.0),
);
switch (value) {
case true:
return Container(
decoration: boxDecoration,
padding: const EdgeInsets.all(8),
child: const Icon(
Icons.verified,
color: Colors.green,
),
);
case false:
return Container(
decoration: boxDecoration,
padding: const EdgeInsets.all(8),
child: const Icon(
Icons.new_releases,
color: Colors.red,
),
);
default:
return Container(
decoration: boxDecoration,
padding: const EdgeInsets.all(8),
child: const Icon(
Icons.hourglass_bottom,
color: Colors.blueGrey,
),
);
}
}),
// We will demonstrate how the refresh feature works
ListItemData(
'Random number',
InternalColors.coal,
description: 'This random number should be updated after refresh',
// If you do not specify the size, the data block will be displayed as a list
widthData: null,
future: _randomNumber,
builder: (value) => value?.toString().toUpperCase(),
),
// Button in common style for example
ListButton('Refresh', InternalColors.green, onPressed: _init)
],
),
),
);
}
}
// SPDX-FileCopyrightText: Copyright 2024 Open Mobile Platform LLC <community@omp.ru>
// SPDX-License-Identifier: BSD-3-Clause
import 'dart:math';
import 'package:flutter/foundation.dart' show kIsAurora;
/// Main features of the plugin <PluginName>
class PluginImpl {
/// The method returns the stream for demonstration
/// Checks the OS and signals whether the current one is Aurora OS
Stream<bool> onIsAurora() async* {
yield kIsAurora;
}
/// The method returns random number for demonstration
Future<int> getNumber() async {
return Future.value(Random().nextInt(100));
}
}
# SPDX-FileCopyrightText: Copyright 2024 Open Mobile Platform LLC <community@omp.ru>
# SPDX-License-Identifier: BSD-3-Clause
name: internal_aurora_example
description: "The Aurora OS example of internal package."
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: '>=3.2.2 <4.0.0'
dependencies:
flutter:
sdk: flutter
internal_aurora:
path: ../
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0
flutter:
uses-material-design: true
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать