Frontend first draft
This commit is contained in:
48
frontend/pweb/lib/widgets/appbar/app_bar.dart
Normal file
48
frontend/pweb/lib/widgets/appbar/app_bar.dart
Normal file
@@ -0,0 +1,48 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/widgets/appbar/profile.dart';
|
||||
import 'package:pweb/widgets/logo.dart';
|
||||
|
||||
|
||||
class PayoutAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
const PayoutAppBar({
|
||||
super.key,
|
||||
required this.title,
|
||||
required this.onAddFundsPressed,
|
||||
this.actions,
|
||||
this.onLogout,
|
||||
this.avatarUrl,
|
||||
});
|
||||
|
||||
final Widget title;
|
||||
final VoidCallback onAddFundsPressed;
|
||||
final List<Widget>? actions;
|
||||
final VoidCallback? onLogout;
|
||||
final String? avatarUrl;
|
||||
|
||||
@override
|
||||
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Padding(
|
||||
padding: const EdgeInsets.only(left: 110, right: 80),
|
||||
child: AppBar(
|
||||
automaticallyImplyLeading: false,
|
||||
title: Row(
|
||||
children: [
|
||||
ServiceLogo(),
|
||||
SizedBox(width: 16),
|
||||
title,
|
||||
],
|
||||
),
|
||||
// leading: Padding(padding: EdgeInsetsGeometry.symmetric(horizontal: 8, vertical: 8), child: ServiceLogo()),
|
||||
actions: [
|
||||
ProfileAvatar(
|
||||
avatarUrl: avatarUrl,
|
||||
onLogout: onLogout,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
13
frontend/pweb/lib/widgets/appbar/notifications.dart
Normal file
13
frontend/pweb/lib/widgets/appbar/notifications.dart
Normal file
@@ -0,0 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class NotificationsButton extends StatelessWidget {
|
||||
const NotificationsButton({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return IconButton(
|
||||
icon: Icon(Icons.notifications),
|
||||
onPressed: null,
|
||||
);
|
||||
}
|
||||
}
|
||||
40
frontend/pweb/lib/widgets/appbar/profile.dart
Normal file
40
frontend/pweb/lib/widgets/appbar/profile.dart
Normal file
@@ -0,0 +1,40 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class ProfileAvatar extends StatelessWidget {
|
||||
const ProfileAvatar({super.key, this.avatarUrl, this.onLogout});
|
||||
|
||||
final String? avatarUrl;
|
||||
final VoidCallback? onLogout;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => PopupMenuButton<int>(
|
||||
tooltip: AppLocalizations.of(context)!.profile,
|
||||
onSelected: (value) {
|
||||
if (value == 1) onLogout?.call();
|
||||
},
|
||||
itemBuilder: (_) => [
|
||||
PopupMenuItem<int>(
|
||||
value: 1,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.logout,
|
||||
size: 20,
|
||||
color: Theme.of(context).iconTheme.color,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(AppLocalizations.of(context)!.logout),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
child: CircleAvatar(
|
||||
radius: 16,
|
||||
foregroundImage: avatarUrl != null ? NetworkImage(avatarUrl!) : null,
|
||||
child: avatarUrl == null ? const Icon(Icons.person, size: 24) : null,
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user