-
Notifications
You must be signed in to change notification settings - Fork 52
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
Make popup menu scrollable when it doesn't fit on screen #8
Comments
plz paste the code to verify this problem. |
Codeimport 'package:flutter/material.dart';
import 'package:custom_pop_up_menu/custom_pop_up_menu.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key? key, this.title}) : super(key: key);
final String? title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
CustomPopupMenuController _controller = CustomPopupMenuController();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title!),
),
body: CustomPopupMenu(
child: Container(
child: Icon(Icons.add_circle_outline, color: Colors.red),
padding: EdgeInsets.all(10),
),
menuBuilder: () => ClipRRect(
borderRadius: BorderRadius.circular(5),
child: Container(
color: const Color(0xFF4C4C4C),
child: IntrinsicWidth(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: List.generate(15, (index) => "List $index")
.map(
(item) => GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: _controller.hideMenu,
child: Container(
height: 40,
padding: EdgeInsets.symmetric(horizontal: 20),
child: Row(
children: <Widget>[
Expanded(
child: Container(
margin: EdgeInsets.only(left: 10),
padding: EdgeInsets.symmetric(vertical: 10),
child: Text(
item,
style: TextStyle(
color: Colors.white,
fontSize: 12,
),
),
),
),
],
),
),
),
)
.toList(),
),
),
),
),
pressType: PressType.singleClick,
verticalMargin: -10,
controller: _controller,
),
);
}
}
There are two problems here:
|
Although there's a lot of space in the bottom direction, the popup goes upward. The popup goes out of the screen, how can I make it scrollable in this case?
|
Can the library somehow constraints the height, so that I could use something like |
Hi,
Thanks for the great plugin.
I have a popup menu button, when it's at the top of the page, the menu will fit on the screen. But when it's at the middle of the page, the menu goes out of the screen.
How can I make the menu scrollable only when it doesn't fit on screen?
The text was updated successfully, but these errors were encountered: