bridge_me 1.0.2+2
bridge_me: ^1.0.2+2 copied to clipboard
Bridge frees you from context restrictions.
Sure, I can improve the documentation for each of these components:
Bridge #
The Bridge widget serves as a centralized configuration point for MaterialApp properties in a Flutter application.
Usage #
To configure MaterialApp using the Bridge widget, follow these steps:
- Import the package: Import the package in your Dart file where you want to use it.
import 'package:bridge/main.dart';
- Define your MaterialApp: Wrap your MaterialApp widget with the
Bridgewidget and configure it with desired properties.
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Bridge(
title: 'My App',
home: MyHomePage(),
theme: ThemeData(primarySwatch: Colors.blue),
);
}
}
In this example, MyApp is wrapped with the Bridge widget, providing centralized configuration for the MaterialApp.
Any Time You Need ❌ Context Just Use ✅BridgeContext to anywhere its global. #
// BridgeContext
Navigator.of(BridgeContext).push(...);
BridgeSnackbar #
The BridgeSnackbar class provides a simple way to display SnackBars using the Bridge pattern for navigation context.
Usage #
To display a SnackBar using the BridgeSnackbar class, follow these steps:
- Import the package: Import the package in your Dart file where you want to use it.
import 'package:bridge/main.dart';
- Show the SnackBar: Use the
BridgeSnackbar.showmethod to display the SnackBar.
SnackBar snackBar = SnackBar(content: Text('Hello from Snackbar!'));
BridgeSnackbar.show(snackBar);
This code will display the SnackBar with the specified content.
BridgeNavigate #
The BridgeNavigate class offers utilities for navigating within a Flutter application using the Bridge pattern for navigation context.
Usage #
To navigate within your app using the BridgeNavigate class, follow these steps:
- Import the package: Import the package in your Dart file where you want to use it.
import 'package:bridge/main.dart';
- Use the navigation methods: Utilize methods like
push,pop,canPop,pushNamed,pushReplacementNamed,popAndPushNamed, andpushNamedAndRemoveUntilfor navigation tasks.
BridgeNavigate.push(NewScreen());
This code pushes a new screen onto the navigation stack or you no need context.
BridgeDialog #
The BridgeDialog class provides a straightforward way to display AlertDialogs using the Bridge pattern for navigation context.
Usage #
To display an AlertDialog using the BridgeDialog class, follow these steps:
- Import the package: Import the package in your Dart file where you want to use it.
import 'package:bridge/main.dart';
- Show the AlertDialog: Use the
BridgeDialog.showmethod to display the AlertDialog.
BridgeDialog.show(
AlertDialog(
title: Text('Alert'),
content: Text('This is an alert dialog.'),
actions: <Widget>[
TextButton(
onPressed: () {
BridgeDialog.pop(); // Close the dialog
},
child: Text('OK'),
),
],
),
);
This code will display an AlertDialog with the specified content.
BridgeProvider #
The BridgeProvider class offers a convenient way to access providers using the Bridge pattern for context.
Usage #
To access providers using the BridgeProvider class, follow these steps:
- Import the package: Import the package in your Dart file where you want to use it.
import 'package:bridge/main.dart';
- Access the Provider: Use the
BridgeProvider.of<T>method to access the provider of typeT.
MyProvider myProvider = BridgeProvider.of<MyProvider>();
This code retrieves the provider of type MyProvider using the Bridge pattern for context.
These improvements should make the documentation clearer and easier to follow. Let me know if you need further assistance!