简体   繁体   English

设计交互式仪表板时的最佳实践 Flutter

[英]Best practices when designing an interactive dashboard Flutter

I'm working towards designing an interactive menu.我正在努力设计一个交互式菜单。 The main idea is a dashboard with some buttons within (see picture for example).主要思想是一个带有一些按钮的仪表板(例如参见图片)。 After an user clicks on the picture, the app would render a similar dashboard, but with different buttons.用户点击图片后,应用程序将呈现一个类似的仪表板,但按钮不同。

The flow of the dashboard would have depth 3 => Main categories => sub categories => sub sub categories.仪表板的流程将具有深度 3 => 主要类别 => 子类别 => 子子类别。

My question here is, what is the best practice to avoid the user from generating a lot of screens within the app (by clicking a lot of buttons)?我的问题是,避免用户在应用程序中生成大量屏幕(通过单击大量按钮)的最佳做法是什么? Does flutter automatically take care of this? flutter 会自动解决这个问题吗? I guess my main concern is, what could go wrong in terms of designing something like this in terms of cell phone using too much power to render the app?我想我主要担心的是,go 在设计这样的东西方面会出现什么错误,因为手机使用过多的电量来呈现应用程序?

Thanks!谢谢!

在此处输入图像描述

My humble approach toward this is to create only one view (screen) and use a state management package to update the view.我对此的谦逊方法是只创建一个视图(屏幕)并使用 state 管理 package 来更新视图。 I'm familiar with flutter_bloc .我熟悉flutter_bloc

In your state you would define an int to keep track of the menu level:在您的 state 中,您将定义一个 int 来跟踪菜单级别:

  • menuLevel == 0: main memu menuLevel == 0: 主菜单
  • menuLevel == 1: sub menu menuLevel == 1:子菜单
  • menuLevel == 2: sub sub menu menuLevel == 2:子子菜单

Then in your view's BlocBuilder you update the view based on the menuLevel state property.然后在视图的 BlocBuilder 中,根据 menuLevel state 属性更新视图。

This answer might sound a bit vag because it assumes that you are familiar with state management in Flutter.这个答案可能听起来有点飘忽,因为它假定您熟悉 Flutter 中的 state 管理。 In particular with flutter_bloc.特别是flutter_bloc。 If not, I strongly recommend you learn a bit more about state management as it will save you time and help you better tackle this kind of situation in an efficient manner.如果没有,我强烈建议您了解更多有关 state 管理的信息,因为它可以节省您的时间并帮助您以有效的方式更好地解决这种情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM