flutter - Flutter widget that scales it's child before laying it out?
问题描述
I'm developing a File Manager app in Flutter, and I want to implement a feature where the user can have multiple tabs open in the app (like Chrome tabs or Tabs in ES File Explorer). For the transition animation I'm chosing to implement a scaling animation, where I scale down the current tab to reveal other open tabs in the background. To achieve this I'm using a ListView to hold the tabs and a Tansform.scale to scale down the tabs. But I'm getting an unexpected result. The pictures below show my expected vs actual result: (First one is the expected result, designed by me in Adobe XD, and the second one is the result I get)
After reading online, I learn that Transform.scale, scales it's child after laying it out, so the boundary of the page remain same even after scaling and thus, I get the 2nd result. So is there a widget that can scale it's child before laying it out, so that I get the result I want?
解决方案
你的意思是,除了 https://api.flutter.dev/flutter/widgets/FittedBox-class.html是否还有一个小部件可以做你想做的事?:)
或者,如果这不是您想要的,请查看其来源并借用这些想法。FittedBox 中汇集了一些非常好的东西。
推荐阅读
- c# - 如何在 wpf 导航中为主窗口及其导航页面创建相同的中心
- python-3.x - 我想通过使用“pyserial”与“TestEquity1000”温度室通信
- typescript - src/app/app.component.ts(391,9) 中的错误:错误 TS7017:元素 > 隐式具有“任何”类型,因为类型“Foo”没有索引签名
- flutter - 我想知道flutter中的NumberFormat.currency构造函数不知道如何实现请指导我
- javascript - setCustomValidity 到 Bootstrap 4 验证?
- angular - 在我的以下代码中重定向到资产页面时面临问题
- html - 如何对齐表头列和表体列的宽度?
- html - Bootstrap : Unable to center contents of entire row
- android - PreferenceManager getDefaultSharedPreferences deprecated in Android Q
- swift - SwiftUI 中的内容是什么?