add web support
This commit is contained in:
+12
-9
@@ -2,6 +2,7 @@ import 'dart:io';
|
||||
|
||||
import 'package:como_gasto/como_gasto_localizations.dart';
|
||||
import 'package:como_gasto/others/category_selection_widget.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
@@ -42,17 +43,19 @@ class _AddPageState extends State<AddPage> with SingleTickerProviderStateMixin {
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_localAth = LocalAuthentication();
|
||||
_localAth.canCheckBiometrics.then((b) async {
|
||||
var methods = await _localAth.getAvailableBiometrics();
|
||||
var hasFingerprint = Platform.isIOS
|
||||
? methods.any((m) => m == BiometricType.fingerprint)
|
||||
: true;
|
||||
if (kIsWeb) {
|
||||
_localAth = LocalAuthentication();
|
||||
_localAth.canCheckBiometrics.then((b) async {
|
||||
var methods = await _localAth.getAvailableBiometrics();
|
||||
var hasFingerprint = Platform.isIOS
|
||||
? methods.any((m) => m == BiometricType.fingerprint)
|
||||
: true;
|
||||
|
||||
setState(() {
|
||||
_isBiometricAvailable = b && hasFingerprint;
|
||||
setState(() {
|
||||
_isBiometricAvailable = b && hasFingerprint;
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
_controller = AnimationController(
|
||||
vsync: this,
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:como_gasto/como_gasto_icons.dart';
|
||||
import 'package:como_gasto/como_gasto_localizations.dart';
|
||||
import 'package:como_gasto/others/month_widget.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:rect_getter/rect_getter.dart';
|
||||
@@ -74,7 +75,6 @@ class _HomePageState extends State<HomePage> {
|
||||
SizedBox(width: 48.0),
|
||||
_bottomAction(ComoGastoIcons.cart, () {}),
|
||||
_bottomAction(ComoGastoIcons.settings, () {
|
||||
|
||||
Navigator.pushNamed(context, '/settings');
|
||||
}),
|
||||
],
|
||||
@@ -98,7 +98,9 @@ class _HomePageState extends State<HomePage> {
|
||||
}
|
||||
|
||||
Widget _body() {
|
||||
ComoGastoLocalizations localizations = Localizations.of<ComoGastoLocalizations>(context, ComoGastoLocalizations);
|
||||
ComoGastoLocalizations localizations =
|
||||
Localizations.of<ComoGastoLocalizations>(
|
||||
context, ComoGastoLocalizations);
|
||||
return SafeArea(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
@@ -205,6 +207,9 @@ class _HomePageState extends State<HomePage> {
|
||||
}
|
||||
|
||||
void setupNotificationPlugin() {
|
||||
if (kIsWeb) {
|
||||
return;
|
||||
}
|
||||
flutterLocalNotificationsPlugin = new FlutterLocalNotificationsPlugin();
|
||||
|
||||
// initialise the plugin. app_icon needs to be a added as a drawable resource to the Android head project
|
||||
|
||||
@@ -21,10 +21,7 @@ class LoginPage extends StatelessWidget {
|
||||
children: <Widget>[
|
||||
Text(
|
||||
localizations.t('login.title'),
|
||||
style: Theme
|
||||
.of(context)
|
||||
.textTheme
|
||||
.display1,
|
||||
style: Theme.of(context).textTheme.display1,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(32.0),
|
||||
@@ -38,10 +35,7 @@ class LoginPage extends StatelessWidget {
|
||||
),
|
||||
Text(
|
||||
localizations.t('login.subtitle'),
|
||||
style: Theme
|
||||
.of(context)
|
||||
.textTheme
|
||||
.caption,
|
||||
style: Theme.of(context).textTheme.caption,
|
||||
),
|
||||
Consumer<LoginState>(
|
||||
builder: (BuildContext context, LoginState value, Widget child) {
|
||||
@@ -64,7 +58,7 @@ class LoginPage extends StatelessWidget {
|
||||
backgroundColor: Color(0xff4285F4),
|
||||
child: Icon(FontAwesomeIcons.google),
|
||||
onPressed: () {
|
||||
Provider.of<LoginState>(context)
|
||||
Provider.of<LoginState>(context, listen: false)
|
||||
.login(LoginProvider.GOOGLE);
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user