小编Aka*_*tel的帖子

是否可以使用Android导航架构组件(Android Jetpack)有条件地设置startDestination?

我使用的导航Android的Jetpack的屏幕之间进行导航.现在我想动态设置startDestination.

我有一个名为MainActivity的Activity和两个Fragments,FragmentA和FragmentB.

var isAllSetUp : Boolean = // It is dynamic and I’m getting this from Preferences.

    If(isAllSetUp)
    {
     // show FragmentA
    }
    else
    {
     //show FragmentB
    }
Run Code Online (Sandbox Code Playgroud)

我想使用Navigation Architecture Component设置上面的流程.目前我使用startDestionation如下所示,但它不符合我的要求.

<navigation xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:app="http://schemas.android.com/apk/res-auto"
   xmlns:tools="http://schemas.android.com/tools"
   android:id="@+id/lrf_navigation"
   app:startDestination="@id/fragmentA">

   <fragment
       android:id="@+id/fragmentA"
       android:name="com.mindinventory.FragmentA"
       android:label="fragment_a"
       tools:layout="@layout/fragment_a" />
</navigation>
Run Code Online (Sandbox Code Playgroud)

是否可以使用Android导航架构组件有条件地设置startDestination?

android android-jetpack android-architecture-navigation

31
推荐指数
3
解决办法
9029
查看次数

如何在Flutter中使用界面?

我有两个小部件,widget1和widget2。Widget1:我在此小部件中添加了一个下拉菜单。现在,我想在下拉项更改事件上更新widget2的views属性(例如颜色和名称)。

那么,我可以使用接口来满足上述要求吗?还是有其他方法可以执行相同的操作?

Widget1
 - Text
 - DropdownButton
     - OnChange(){
        // Update widget2 (change txt1 & color1 values)
       }


Widget2
 - Text
 - Container
     - Card
         - Text (txt1, color1...)
Run Code Online (Sandbox Code Playgroud)

flutter flutter-layout

2
推荐指数
1
解决办法
2923
查看次数