Java源码示例:io.flutter.facade.Flutter

示例1
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
    switch (item.getItemId()) {
        case R.id.navigation_home:
            if (firstFragment == null) {
                firstFragment = createFragment("Android Page 1");
            }
            showFragment(firstFragment, "first");
            hideFragment(secondFragment);
            hideFragment(thirdFragment);
            return true;
        case R.id.navigation_dashboard:
            if (secondFragment == null) {
                secondFragment = createFragment("Android Page 2");
            }
            showFragment(secondFragment, "second");
            hideFragment(firstFragment);
            hideFragment(thirdFragment);

            return true;
        case R.id.navigation_notifications:
            if (thirdFragment == null) {
                thirdFragment = Flutter.createFragment(null);
            }
            showFragment(thirdFragment, "flutter");
            hideFragment(firstFragment);
            hideFragment(secondFragment);
            return true;
    }
    return false;
}