kopia lustrzana https://gitlab.com/mysocialportal/relatica
Add drawer capability to Contacts Screen
rodzic
4a3c4bd4fd
commit
b0ee7fabac
|
@ -0,0 +1,20 @@
|
|||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../globals.dart';
|
||||
import '../services/auth_service.dart';
|
||||
|
||||
Widget? buildCurrentProfileButton(BuildContext context) {
|
||||
final service = getIt<AccountsService>();
|
||||
if (!service.loggedIn) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return Builder(builder: (context) {
|
||||
return IconButton(
|
||||
onPressed: () {
|
||||
Scaffold.of(context).openDrawer();
|
||||
},
|
||||
icon: CachedNetworkImage(imageUrl: service.currentProfile.avatar));
|
||||
});
|
||||
}
|
|
@ -1,26 +1,12 @@
|
|||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../globals.dart';
|
||||
import '../services/auth_service.dart';
|
||||
import 'current_profile_button.dart';
|
||||
|
||||
class StandardAppBar {
|
||||
static AppBar build(BuildContext context, String title,
|
||||
{bool withDrawer = false, List<Widget>? actions}) {
|
||||
final service = getIt<AccountsService>();
|
||||
return AppBar(
|
||||
leading: withDrawer
|
||||
? service.loggedIn
|
||||
? Builder(builder: (context) {
|
||||
return IconButton(
|
||||
onPressed: () {
|
||||
Scaffold.of(context).openDrawer();
|
||||
},
|
||||
icon: CachedNetworkImage(
|
||||
imageUrl: service.currentProfile.avatar));
|
||||
})
|
||||
: null
|
||||
: null,
|
||||
leading: withDrawer ? buildCurrentProfileButton(context) : null,
|
||||
title: Text(
|
||||
title,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
|
|
|
@ -2,9 +2,11 @@ import 'package:flutter/material.dart';
|
|||
import 'package:go_router/go_router.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:relatica/controls/standard_app_drawer.dart';
|
||||
import 'package:relatica/utils/active_profile_selector.dart';
|
||||
|
||||
import '../controls/app_bottom_nav_bar.dart';
|
||||
import '../controls/current_profile_button.dart';
|
||||
import '../controls/padding.dart';
|
||||
import '../controls/status_and_refresh_button.dart';
|
||||
import '../globals.dart';
|
||||
|
@ -64,7 +66,9 @@ class _ContactsScreenState extends State<ContactsScreen> {
|
|||
separatorBuilder: (context, index) => const Divider(),
|
||||
itemCount: contacts.length);
|
||||
}
|
||||
final profileButton = buildCurrentProfileButton(context);
|
||||
return Scaffold(
|
||||
drawer: StandardAppDrawer(),
|
||||
body: SafeArea(
|
||||
child: RefreshIndicator(
|
||||
onRefresh: () async {
|
||||
|
@ -81,6 +85,10 @@ class _ContactsScreenState extends State<ContactsScreen> {
|
|||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
if (profileButton != null) ...[
|
||||
SizedBox(width: 70.0, child: profileButton),
|
||||
const HorizontalPadding(),
|
||||
],
|
||||
Expanded(
|
||||
child: TextField(
|
||||
onChanged: (value) {
|
||||
|
|
Ładowanie…
Reference in New Issue