Browse Source

neon, neon_notifications: make AppImplementation.buildIcon a builder

pull/387/head
Nikolas Rimikis 2 years ago
parent
commit
6472214a57
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 2
      packages/neon/neon/lib/src/pages/home.dart
  2. 2
      packages/neon/neon/lib/src/pages/settings.dart
  3. 17
      packages/neon/neon/lib/src/utils/app_implementation.dart
  4. 1
      packages/neon/neon/lib/src/widgets/app_implementation_icon.dart
  5. 1
      packages/neon/neon_notifications/lib/pages/main.dart

2
packages/neon/neon/lib/src/pages/home.dart

@ -356,7 +356,7 @@ class _HomePageState extends State<HomePage> {
],
],
),
leading: appImplementation.buildIcon(context),
leading: appImplementation.buildIcon(),
minLeadingWidth: 0,
onTap: () async {
await _appsBloc.setActiveApp(appImplementation.id);

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

@ -78,7 +78,7 @@ class _SettingsPageState extends State<SettingsPage> {
for (final appImplementation in appImplementations) ...[
if (appImplementation.options.options.isNotEmpty) ...[
CustomSettingsTile(
leading: appImplementation.buildIcon(context),
leading: appImplementation.buildIcon(),
title: Text(appImplementation.name(context)),
onTap: () {
NextcloudAppSettingsRoute(appid: appImplementation.id).go(context);

17
packages/neon/neon/lib/src/utils/app_implementation.dart

@ -41,17 +41,18 @@ abstract class AppImplementation<T extends Bloc, R extends NextcloudAppSpecificO
Widget get page;
Widget buildIcon(
final BuildContext context, {
Widget buildIcon({
final Size size = const Size.square(32),
final Color? color,
}) =>
SizedBox.fromSize(
size: size,
child: SvgPicture.asset(
'assets/app.svg',
package: 'neon_$id',
colorFilter: ColorFilter.mode(color ?? Theme.of(context).colorScheme.primary, BlendMode.srcIn),
Builder(
builder: (final context) => SizedBox.fromSize(
size: size,
child: SvgPicture.asset(
'assets/app.svg',
package: 'neon_$id',
colorFilter: ColorFilter.mode(color ?? Theme.of(context).colorScheme.primary, BlendMode.srcIn),
),
),
);

1
packages/neon/neon/lib/src/widgets/app_implementation_icon.dart

@ -24,7 +24,6 @@ class NeonAppImplementationIcon extends StatelessWidget {
Container(
margin: const EdgeInsets.all(5),
child: appImplementation.buildIcon(
context,
size: size,
color: color,
),

1
packages/neon/neon_notifications/lib/pages/main.dart

@ -74,7 +74,6 @@ class _NotificationsMainPageState extends State<NotificationsMainPage> {
),
leading: app != null
? app.buildIcon(
context,
size: const Size.square(40),
)
: SizedBox.fromSize(

Loading…
Cancel
Save