Browse Source

neon,app: Add branding config

pull/253/head
jld3103 2 years ago
parent
commit
b6ffc8a36c
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 0
      packages/app/assets/logo_neon.svg
  2. 4
      packages/app/integration_test/screenshot_test.dart
  3. 12
      packages/app/lib/branding.dart
  4. 4
      packages/app/lib/main.dart
  5. 2
      packages/app/pubspec.lock
  6. 3
      packages/app/pubspec.yaml
  7. 2
      packages/neon/neon/assets/LEGALESE.txt
  8. 1
      packages/neon/neon/lib/l10n/en.arb
  9. 6
      packages/neon/neon/lib/l10n/localizations.dart
  10. 3
      packages/neon/neon/lib/l10n/localizations_en.dart
  11. 8
      packages/neon/neon/lib/neon.dart
  12. 9
      packages/neon/neon/lib/src/pages/login.dart
  13. 10
      packages/neon/neon/lib/src/pages/settings.dart
  14. 15
      packages/neon/neon/lib/src/utils/branding.dart
  15. 28
      packages/neon/neon/lib/src/widgets/neon_logo.dart

0
packages/neon/neon/assets/logo_neon.svg → packages/app/assets/logo_neon.svg

Before

Width:  |  Height:  |  Size: 842 B

After

Width:  |  Height:  |  Size: 842 B

4
packages/app/integration_test/screenshot_test.dart

@ -1,6 +1,7 @@
import 'dart:io'; import 'dart:io';
import 'package:app/apps.dart'; import 'package:app/apps.dart';
import 'package:app/branding.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
@ -92,8 +93,9 @@ Future runTestApp(
final Account? account, final Account? account,
}) async { }) async {
await runNeon( await runNeon(
getAppImplementations: getAppImplementations,
binding: binding, binding: binding,
getAppImplementations: getAppImplementations,
branding: getNeonBranding(),
sharedPreferencesOverride: MemorySharedPreferences(), sharedPreferencesOverride: MemorySharedPreferences(),
account: account, account: account,
firstLaunchDisabled: true, firstLaunchDisabled: true,

12
packages/app/lib/branding.dart

@ -0,0 +1,12 @@
import 'package:flutter_svg/flutter_svg.dart';
import 'package:neon/neon.dart';
Branding getNeonBranding() => Branding(
name: 'Nextcloud Neon',
legalese: 'Copyright © 2023, provokateurin\nUnder GPLv3 license',
buildLogo: (final context, final size) => SvgPicture.asset(
'assets/logo_neon.svg',
width: size.width,
height: size.height,
),
);

4
packages/app/lib/main.dart

@ -1,10 +1,12 @@
import 'package:app/apps.dart'; import 'package:app/apps.dart';
import 'package:app/branding.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:neon/neon.dart'; import 'package:neon/neon.dart';
Future main() async { Future main() async {
await runNeon( await runNeon(
getAppImplementations: getAppImplementations,
binding: WidgetsFlutterBinding.ensureInitialized(), binding: WidgetsFlutterBinding.ensureInitialized(),
getAppImplementations: getAppImplementations,
branding: getNeonBranding(),
); );
} }

2
packages/app/pubspec.lock

@ -256,7 +256,7 @@ packages:
source: hosted source: hosted
version: "2.0.9" version: "2.0.9"
flutter_svg: flutter_svg:
dependency: transitive dependency: "direct main"
description: description:
name: flutter_svg name: flutter_svg
sha256: "6ff9fa12892ae074092de2fa6a9938fb21dbabfdaa2ff57dc697ff912fc8d4b2" sha256: "6ff9fa12892ae074092de2fa6a9938fb21dbabfdaa2ff57dc697ff912fc8d4b2"

3
packages/app/pubspec.yaml

@ -10,6 +10,7 @@ dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
flutter_native_splash: ^2.2.0+1 flutter_native_splash: ^2.2.0+1
flutter_svg: ^1.1.6
neon: neon:
path: ../neon/neon path: ../neon/neon
neon_files: neon_files:
@ -35,3 +36,5 @@ dev_dependencies:
flutter: flutter:
uses-material-design: true uses-material-design: true
assets:
- assets/

2
packages/neon/neon/assets/LEGALESE.txt

@ -1,2 +0,0 @@
Copyright © 2022, provokateurin
Under GPLv3 license

1
packages/neon/neon/lib/l10n/en.arb

@ -1,6 +1,5 @@
{ {
"@@locale": "en", "@@locale": "en",
"appName": "Nextcloud Neon",
"appImplementationName": "{app, select, core{Server} files{Files} news{News} notes{Notes} notifications{Notifications} other{}}", "appImplementationName": "{app, select, core{Server} files{Files} news{News} notes{Notes} notifications{Notifications} other{}}",
"@appImplementationName": { "@appImplementationName": {
"placeholders": { "placeholders": {

6
packages/neon/neon/lib/l10n/localizations.dart

@ -89,12 +89,6 @@ abstract class AppLocalizations {
/// A list of this localizations delegate's supported locales. /// A list of this localizations delegate's supported locales.
static const List<Locale> supportedLocales = <Locale>[Locale('en')]; static const List<Locale> supportedLocales = <Locale>[Locale('en')];
/// No description provided for @appName.
///
/// In en, this message translates to:
/// **'Nextcloud Neon'**
String get appName;
/// No description provided for @appImplementationName. /// No description provided for @appImplementationName.
/// ///
/// In en, this message translates to: /// In en, this message translates to:

3
packages/neon/neon/lib/l10n/localizations_en.dart

@ -6,9 +6,6 @@ import 'localizations.dart';
class AppLocalizationsEn extends AppLocalizations { class AppLocalizationsEn extends AppLocalizations {
AppLocalizationsEn([String locale = 'en']) : super(locale); AppLocalizationsEn([String locale = 'en']) : super(locale);
@override
String get appName => 'Nextcloud Neon';
@override @override
String appImplementationName(String app) { String appImplementationName(String app) {
String _temp0 = intl.Intl.selectLogic( String _temp0 = intl.Intl.selectLogic(

8
packages/neon/neon/lib/neon.dart

@ -70,6 +70,7 @@ part 'src/platform/platform.dart';
part 'src/utils/account_options.dart'; part 'src/utils/account_options.dart';
part 'src/utils/app_implementation.dart'; part 'src/utils/app_implementation.dart';
part 'src/utils/bloc.dart'; part 'src/utils/bloc.dart';
part 'src/utils/branding.dart';
part 'src/utils/confirmation_dialog.dart'; part 'src/utils/confirmation_dialog.dart';
part 'src/utils/global.dart'; part 'src/utils/global.dart';
part 'src/utils/global_options.dart'; part 'src/utils/global_options.dart';
@ -101,16 +102,16 @@ part 'src/widgets/exception.dart';
part 'src/widgets/image_wrapper.dart'; part 'src/widgets/image_wrapper.dart';
part 'src/widgets/linear_progress_indicator.dart'; part 'src/widgets/linear_progress_indicator.dart';
part 'src/widgets/list_view.dart'; part 'src/widgets/list_view.dart';
part 'src/widgets/neon_logo.dart';
part 'src/widgets/nextcloud_logo.dart'; part 'src/widgets/nextcloud_logo.dart';
part 'src/widgets/relative_time.dart'; part 'src/widgets/relative_time.dart';
part 'src/widgets/result_builder.dart'; part 'src/widgets/result_builder.dart';
part 'src/widgets/text_settings_tile.dart'; part 'src/widgets/text_settings_tile.dart';
Future runNeon({ Future runNeon({
required final WidgetsBinding binding,
required final List<AppImplementation> Function(SharedPreferences, RequestManager, NeonPlatform) required final List<AppImplementation> Function(SharedPreferences, RequestManager, NeonPlatform)
getAppImplementations, getAppImplementations,
required final WidgetsBinding binding, required final Branding branding,
final SharedPreferences? sharedPreferencesOverride, final SharedPreferences? sharedPreferencesOverride,
final Account? account, final Account? account,
final bool firstLaunchDisabled = false, final bool firstLaunchDisabled = false,
@ -195,6 +196,9 @@ Future runNeon({
Provider<PackageInfo>( Provider<PackageInfo>(
create: (final _) => packageInfo, create: (final _) => packageInfo,
), ),
Provider<Branding>(
create: (final _) => branding,
),
], ],
child: NeonApp( child: NeonApp(
accountsBloc: accountsBloc, accountsBloc: accountsBloc,

9
packages/neon/neon/lib/src/pages/login.dart

@ -172,7 +172,14 @@ class _LoginPageState extends State<LoginPage> {
height: MediaQuery.of(context).size.height / 2, height: MediaQuery.of(context).size.height / 2,
child: Column( child: Column(
children: [ children: [
const NeonLogo(), Provider.of<Branding>(context, listen: false).buildLogo(
context,
const Size(100, 100),
),
Text(
Provider.of<Branding>(context, listen: false).name,
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox( const SizedBox(
height: 30, height: 30,
), ),

10
packages/neon/neon/lib/src/pages/settings.dart

@ -218,13 +218,15 @@ class _SettingsPageState extends State<SettingsPage> {
), ),
title: Text(AppLocalizations.of(context).licenses), title: Text(AppLocalizations.of(context).licenses),
onTap: () async { onTap: () async {
final branding = Provider.of<Branding>(context, listen: false);
showLicensePage( showLicensePage(
context: context, context: context,
applicationName: AppLocalizations.of(context).appName, applicationName: branding.name,
applicationIcon: const NeonLogo( applicationIcon: branding.buildLogo(
withoutText: true, context,
const Size(100, 100),
), ),
applicationLegalese: await rootBundle.loadString('assets/LEGALESE.txt'), applicationLegalese: branding.legalese,
applicationVersion: Provider.of<PackageInfo>(context, listen: false).version, applicationVersion: Provider.of<PackageInfo>(context, listen: false).version,
); );
}, },

15
packages/neon/neon/lib/src/utils/branding.dart

@ -0,0 +1,15 @@
part of '../../neon.dart';
class Branding {
Branding({
required this.name,
required this.buildLogo,
this.legalese,
});
final String name;
final Widget Function(BuildContext, Size) buildLogo;
final String? legalese;
}

28
packages/neon/neon/lib/src/widgets/neon_logo.dart

@ -1,28 +0,0 @@
part of '../../neon.dart';
class NeonLogo extends StatelessWidget {
const NeonLogo({
this.withoutText = false,
super.key,
});
final bool withoutText;
@override
Widget build(final BuildContext context) => Column(
children: [
SvgPicture.asset(
'assets/logo_neon.svg',
package: 'neon',
width: 100,
height: 100,
),
if (!withoutText) ...[
Text(
AppLocalizations.of(context).appName,
style: Theme.of(context).textTheme.titleLarge,
),
],
],
);
}
Loading…
Cancel
Save