-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Manually opening Backdrop #131
Comments
Hi @pishguy, thanks for opening the issue. You
|
@WieFel hi again :) could you help me whats the correct using
|
I think the problem here is that the So, having the |
@WieFel if i put my widget has a default is this your meant? @override
Widget build(ILocationScreenWidgetModel wm) {
return ValueListenableBuilder<bool>(
valueListenable: wm.bottomSheetVisibility,
builder: (context, bool visibility, __) {
return WillPopScope(
onWillPop: () async {
if (visibility) {
wm.bottomSheetVisibility.value = false;
Backdrop.of(context).fling();
return Future.value(false);
}
wm.bottomSheetVisibility.value = true;
return Future.value(true);
},
child: BackdropScaffold(
...
onBackLayerConcealed: () {
wm.bottomSheetVisibility.value = true;
},
onBackLayerRevealed: () {
wm.bottomSheetVisibility.value = false;
}, problem is closing the return ValueListenableBuilder<bool>(
valueListenable: wm.bottomSheetVisibility,
builder: (_, bool visibility, __) {
return Builder(
builder: (context) {
return WillPopScope(
onWillPop: () async {
if (visibility) {
wm.bottomSheetVisibility.value = false;
Backdrop.of(context).fling();
return Future.value(false);
}
wm.bottomSheetVisibility.value = true;
return Future.value(true);
},
child: BackdropScaffold(
//...
subHeader: BackdropSubHeader(
leading: Builder(
builder: (context) {
return IconButton(
onPressed: () => Backdrop.of(context).fling(),
icon: const Icon(Icons.close_rounded),
);
},
), |
Could you briefly explain again what you are trying to achieve? as far as I understand, you have the following:
is that correct? |
In the default state, the The second issue is that when the These two states were not implementable outside of the library, so I modified the library itself to address these issues. please check this pull request: #135 |
I created a small example app for you, which does the following:
import 'package:backdrop/backdrop.dart';
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Backdrop Demo',
home: Scaffold(
appBar: AppBar(
title: const Text("My App"),
),
body: Center(
// Builder necessary here to be able to use Navigator.push (as we are in the same widget as
// our MaterialApp)
child: Builder(builder: (context) {
return ElevatedButton(
child: const Text("Open Backdrop Page"),
onPressed: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const MyCustomPage(),
),
),
);
}),
),
),
);
}
}
class MyCustomPage extends StatelessWidget {
const MyCustomPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return BackdropScaffold(
appBar: AppBar(
title: const Text("Backdrop Example"),
),
concealBacklayerOnBackButton: false,
revealBackLayerAtStart: true,
backLayerBackgroundColor: Colors.grey.shade300,
backLayer: Center(
// Builder necessary here to be able to call Backdrop.of(context), as we are inside the same
// widget as our BackdropScaffold
child: Builder(
builder: (context) {
return ElevatedButton(
onPressed: () => Backdrop.of(context).concealBackLayer(),
child: const Text("Conceal Back Layer"),
);
},
),
),
subHeader: const BackdropSubHeader(
title: Text("Sub Header"),
),
frontLayer: const Center(
child: Text("Front Layer"),
),
);
}
} In my opinion, it should not be necessary to make any change to the library for this. |
@WieFel i checked your code, thanks closing |
Yes, but you need to put it in the correct place. As I said, it needs to be BELOW the |
how can i Manually opening Backdrop to show
frontLayer
without using like sample code action such as:this is my code and i get
Null check operator used on a null value
error on this line of codeBackdrop.of(context).fling()
:The text was updated successfully, but these errors were encountered: