admin管理员组文章数量:1297078
Trying experiments with Flutter and found this article how to build a Responsive UI for multiple screen sizes. I want to make 'Header' area to be expandable. Found ExpansionPanel class but can't make this area to be correctly work with. Any suggestions? enter image description here
Trying experiments with Flutter and found this article how to build a Responsive UI for multiple screen sizes. I want to make 'Header' area to be expandable. Found ExpansionPanel class but can't make this area to be correctly work with. Any suggestions? enter image description here
Share Improve this question asked Feb 11 at 16:23 gothicagothica 13 bronze badges1 Answer
Reset to default 0You can use a SilverAppBar
Here is an example of UI that can explain the logic.
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: CustomScrollView(
slivers: <Widget>[
// SliverAppBar is the expandable header
SliverAppBar(
expandedHeight: 200.0, // Maximum header height
floating: false, // Does not float when scrolling
pinned: true, // Fix header when scrolling
snap: false, // Does not "snap" when scrolling
flexibleSpace: FlexibleSpaceBar(
title: Text('Header Expansível'),
background: Imagework(
'https://via.placeholder/400x200', // Background image
fit: BoxFit.cover,
),
),
),
// Content below the header
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return ListTile(
title: Text('Item $index'),
);
},
childCount: 50, // Number of items in the list
),
),
],
),
),
);
}
}
本文标签: user interfaceMake responsive UI element to be expansible vertically in FlutterStack Overflow
版权声明:本文标题:user interface - Make responsive UI element to be expansible vertically in Flutter - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741648005a2390303.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论