Hello, i have a home page, when i click on a button this redirect me to a other page who named description, i use pushScreen whithout nav bar and this work. When im on the description page i need to redirect to other page but with nav bar
When i redirect the nav bar is not showed but it had to show.
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:provider/provider.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:persistent_bottom_nav_bar_v2/persistent_bottom_nav_bar_v2.dart';
import 'package:ayshglamm_app/model/prestations_model.dart';
import 'package:ayshglamm_app/screens/account/register_phone.dart';
import 'package:ayshglamm_app/screens/account/register_email.dart';
import 'package:ayshglamm_app/screens/account/login_email.dart';
import 'package:ayshglamm_app/screens/account/otp_phone.dart';
import 'package:ayshglamm_app/screens/account/splash_screen.dart';
import 'package:ayshglamm_app/screens/home/prestation_description.dart';
import 'package:ayshglamm_app/screens/home/home.dart';
import 'package:ayshglamm_app/screens/cart/cart.dart';
import 'package:ayshglamm_app/screens/cart/cart_empty.dart';
import 'package:ayshglamm_app/screens/cart/date_picker.dart';
import 'package:ayshglamm_app/screens/cart/artist_available.dart';
import 'package:ayshglamm_app/screens/home/home2.dart';
import 'package:ayshglamm_app/screens/account/provider/auth_provider.dart'
as ap;
import 'firebase_options.dart';
import 'package:ayshglamm_app/globals/globals.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
flutterCart.initializeCart(isPersistenceSupportEnabled: true);
// make navigation bar transparent
SystemChrome.setSystemUIOverlayStyle(
const SystemUiOverlayStyle(
systemNavigationBarColor: Colors.transparent,
),
);
// make flutter draw behind navigation bar
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
runApp(const MainApp());
}
ValueNotifier<bool> showNavigationBar = ValueNotifier<bool>(true);
ValueNotifier<int> currentIndex = ValueNotifier<int>(0);
class MainApp extends StatelessWidget {
const MainApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return ScreenUtilInit(
designSize: const Size(390, 844),
minTextAdapt: true,
splitScreenMode: true,
builder: (context, child) {
return MultiProvider(
providers: [
ChangeNotifierProvider(create: (_) => ap.AuthProvider()),
],
child: MaterialApp(
theme: ThemeData(
textSelectionTheme: const TextSelectionThemeData(
cursorColor: Colors.black,
),
),
home: const SplashScreen(),
routes: {
'/minimal': (context) => const MinimalExample(),
'/register-phone': (context) => const RegisterPhonePage(),
'/register-email': (context) =>
const RegisterPage(fromLogin: false),
'/login': (context) => const LoginPage(),
'/otp': (context) => const OTPPage(
verificationId: "",
phoneNumber: "",
fullName: "",
),
'/home2': (context) => const ChoicePrestation(),
'/prestation-description': (context) => DescriptionPrestation(
prestation: Prestation(
id: "",
name: "",
description: "",
category: "",
price: 0,
active: true,
pictureLink: "",
totalSold: 0,
duration: 0,
completed: 0,
waiting: 0,
canceled: 0,
views: 0,
likes: 0,
specifications: '',
createdAt: DateTime.now().toString(),
),
),
'/cart': (context) => const CartDetail(),
'/cart-empty': (context) => const CartEmpty(),
'/choice-meet': (context) => const ChoiceMeet(),
'/available-artist': (context) =>
const ArtistAvailable(artists: []),
'/home': (context) => const HomeView(),
},
),
);
},
);
}
}
class MinimalExample extends StatelessWidget {
const MinimalExample({super.key});
List<PersistentTabConfig> _tabs() => [
PersistentTabConfig(
screen: const HomeView(),
item: ItemConfig(
icon: const Icon(Icons.home),
title: "Home",
),
),
PersistentTabConfig(
screen: const CartDetail(),
item: ItemConfig(
icon: const Icon(Icons.shopping_cart),
title: "Cart",
),
),
PersistentTabConfig(
screen: const ChoicePrestation(),
item: ItemConfig(
icon: const Icon(Icons.list),
title: "Services",
),
),
];
@override
Widget build(BuildContext context) => PersistentTabView(
tabs: _tabs(),
navBarBuilder: (navBarConfig) => Style1BottomNavBar(
navBarConfig: navBarConfig,
),
);
}
onTap: () {
pushScreen(
context,
screen: DescriptionPrestation(
prestation: prestation,
),
withNavBar: false,
);
},//this work
onPressed: () {
addToCart(prestation);
ScaffoldMessenger.of(context)
.showSnackBar(
SnackBar(
content: Text(
'Prestation ajoutée au panier'),
action: SnackBarAction(
label: 'Voir le panier',
onPressed: () {
pushScreen(
context,
screen: CartDetail(),
withNavBar: true,
pageTransitionAnimation:
PageTransitionAnimation
.cupertino,
);
},
),
),
);
},//this dont work
Version
5.2.3
Flutter Doctor Output
[✓] Flutter (Channel stable, 3.19.6, on macOS 14.5 23F79 darwin-arm64, locale fr-FR) • Flutter version 3.19.6 on channel stable at /Users/omid/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 54e66469a9 (7 weeks ago), 2024-04-17 13:08:03 -0700 • Engine revision c4cd48e186 • Dart version 3.3.4 • DevTools version 2.31.1 [✗] Android toolchain - develop for Android devices ✗ Unable to locate Android SDK. Install Android Studio from: https://developer.android.com/studio/index.html On first launch it will assist you in installing the Android SDK components. (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions). If the Android SDK has been installed to a custom location, please use `flutter config --android-sdk` to update to that location. [✓] Xcode - develop for iOS and macOS (Xcode 15.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15E204a • CocoaPods version 1.15.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [!] Android Studio (not installed) • Android Studio not found; download from https://developer.android.com/studio/index.html (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions). [✓] VS Code (version 1.89.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.90.0 [✓] Connected device (3 available) • iPhone 15 Pro Max (mobile) • A5665398-B7F9-4C64-B557-03063DAD272F • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-4 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 14.5 23F79 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 125.0.6422.142 [✓] Network resources • All expected network resources are available. ! Doctor found issues in 2 categories.What platforms are you seeing the problem on?
iOS
What happened?
Hello, i have a home page, when i click on a button this redirect me to a other page who named description, i use pushScreen whithout nav bar and this work. When im on the description page i need to redirect to other page but with nav bar
When i redirect the nav bar is not showed but it had to show.
Steps to reproduce
Code to reproduce the problem
Relevant log output
No response
Screenshots
No response