Skip to content

Instantly share code, notes, and snippets.

View littleironical's full-sized avatar
👻
keep your fingers sharp

Hardik Kumar littleironical

👻
keep your fingers sharp
View GitHub Profile
// ONE-WAY IMPLEMENTATION
Navigator.push(context, SlideLeftRoute(page: Screen2()));
// 1. SLIDE TRANSITION
class SlideLeftRoute extends PageRouteBuilder {
final Widget page;
SlideLeftRoute({this.page})
: super(
pageBuilder: (
BuildContext context,
flutter channel beta
flutter upgrade
flutter config --enable-web
// SAVING DATA
saveString(key, value) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.setString(key, value);
}
saveDouble(key, value) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.setDouble(key, value);
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
// SETTING ORIENTATION TO PORTRAIT
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);
// STABLE
When we believe we have a particularly good build, we promote it to the stable channel.
We intend to do this more or less every quarter, but this may vary. We recommend that you use this channel for all production app releases.
We may ship hotfixes to the stable channel for high-priority bugs, although our intent is to do this rarely.
// MASTER
The current tip-of-tree, absolute latest cutting edge build.
The channel master has the most recent build.
No tests were run before build so there might be broken functionality when using this channel.
// Youtube player
youtube_player_flutter
// Web view
flutter_inappwebview
// Google fonts
google_fonts
// App Icon
// Create "ScrollController"
final ScrollController scrollController = ScrollController();
// Add "scrollController" to "controller" property inside Scroll widget
controller: scrollController,
// Now implement scrolling function
void onTap(){
scrollController.animateTo(0, duration: Duration(seconds: 2), curve: Curves.easeInOut);
// 0 is the offset
import 'dart:js' as js;
//OR
import 'dart:html' as html;
onPressed: () {
js.context.callMethod('open', ['https://play.google.com/store']);
//OR
html.window.open('https://play.google.com/store', 'new tab');
},
//Initialising as 'loading..' because text widget (where you'll be using these variables) can't be null
String firstName = 'loading...'
String lastName = 'loading...'
String title = 'loading...'
class Screen extends StatefulWidget {
@override
_ScreenState createState() => _ScreenState();
}
final CollectionReference items = FirebaseFirestore.instance.collection('Orders');
final body = StreamBuilder<QuerySnapshot>(
stream: items.snapshots(),
builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
if (snapshot.hasError) {
return Container(
child: Center(
child: Text('SOME ERROR HAS OCCURED'),
),