app_preferences_flutter 1.0.0
app_preferences_flutter: ^1.0.0 copied to clipboard
Plugin for open and save native preferences on Android and iOS.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:app_preferences_flutter/app_preferences_flutter.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String a = "";
bool b = false;
String c = "";
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Preferences screen plugin'),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Center(
child: Text(a),
),
Center(
child: Text(b.toString()),
),
Center(
child: Text(c ?? ""),
),
Padding(
padding: EdgeInsets.all(10),
),
RaisedButton(
child: Text("Open preferences screen"),
onPressed: () => AppPreferencesFlutter.openPreferences,
),
RaisedButton(
child: Text("Get values"),
onPressed: () async {
a = await AppPreferencesFlutter.getValue("text_preference");
b = await AppPreferencesFlutter.getValue(
"enabled_preference") ==
"true";
c = await AppPreferencesFlutter.getValue(
"text_password_preference");
setState(() {});
},
),
],
),
),
);
}
}