text
stringlengths 1
372
|
---|
<topic_start> |
how do i log in with facebook? |
to log in with facebook, use the |
flutter_facebook_login community plugin. |
<topic_end> |
<topic_start> |
how do i use firebase features? |
most firebase functions are covered by |
first party plugins. |
these plugins are first-party integrations, |
maintained by the flutter team: |
you can also find some third-party firebase plugins on |
pub.dev that cover areas not directly covered by the |
first-party plugins. |
<topic_end> |
<topic_start> |
how do i build my own custom native integrations? |
if there is platform-specific functionality that flutter |
or its community plugins are missing, |
you can build your own following the |
developing packages and plugins page. |
flutter’s plugin architecture, in a nutshell, is much like using an event bus in |
android: you fire off a message and let the receiver process and emit a result |
back to you. in this case, the receiver is code running on the native side |
on android or iOS. |
<topic_end> |
<topic_start> |
how do i use the NDK in my flutter application? |
if you use the NDK in your current android application and want your flutter |
application to take advantage of your native libraries then it’s possible by |
building a custom plugin. |
your custom plugin first talks to your android app, where you call your |
native functions over JNI. once a response is ready, |
send a message back to flutter and render the result. |
calling native code directly from flutter is currently not supported. |
<topic_end> |
<topic_start> |
themes |
<topic_end> |
<topic_start> |
how do i theme my app? |
out of the box, flutter comes with a beautiful implementation of material |
design, which takes care of a lot of styling and theming needs that you would |
typically do. unlike android where you declare themes in XML and then assign it |
to your application using AndroidManifest.xml, in flutter you declare themes |
in the top level widget. |
to take full advantage of material components in your app, you can declare a top |
level widget MaterialApp as the entry point to your application. MaterialApp |
is a convenience widget that wraps a number of widgets that are commonly |
required for applications implementing material design. |
it builds upon a WidgetsApp by adding material specific functionality. |
you can also use a WidgetsApp as your app widget, which provides some of the |
same functionality, but is not as rich as MaterialApp. |
to customize the colors and styles of any child components, pass a |
ThemeData object to the MaterialApp widget. for example, in the code below, |
the color scheme from seed is set to deepPurple and text selection color is red. |
<code_start> |
import 'package:flutter/material.dart'; |
class SampleApp extends StatelessWidget { |
const SampleApp({super.key}); |
@override |
widget build(BuildContext context) { |
return MaterialApp( |
title: 'sample app', |
theme: ThemeData( |
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), |
textSelectionTheme: |
const TextSelectionThemeData(selectionColor: colors.red), |
), |
home: const SampleAppPage(), |
); |
} |
} |
<code_end> |
<topic_end> |
<topic_start> |
databases and local storage |
<topic_end> |
<topic_start> |
how do i access shared preferences? |
in android, you can store a small collection of key-value pairs using |
the SharedPreferences API. |
in flutter, access this functionality using the |
Shared_Preferences plugin. |
this plugin wraps the functionality of both |
shared preferences and NSUserDefaults (the iOS equivalent). |
<code_start> |
import 'dart:async'; |
import 'package:flutter/material.dart'; |
import 'package:shared_preferences/shared_preferences.dart'; |
void main() { |
runApp( |
const MaterialApp( |
home: scaffold( |
body: center( |
child: ElevatedButton( |
onPressed: _incrementCounter, |
child: Text('Increment counter'), |
), |
), |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.