autofill attempt
This commit is contained in:
parent
cbcdf7418e
commit
64703dbc67
17 changed files with 72 additions and 47 deletions
|
@ -1,6 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:fooder_web/screens/login.dart';
|
||||
import 'package:fooder_web/client.dart';
|
||||
import 'package:fooder/screens/login.dart';
|
||||
import 'package:fooder/client.dart';
|
||||
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import 'package:fooder_web/models/meal.dart';
|
||||
import 'package:fooder/models/meal.dart';
|
||||
|
||||
|
||||
class Diary {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import 'package:fooder_web/models/product.dart';
|
||||
import 'package:fooder/models/product.dart';
|
||||
|
||||
class Entry {
|
||||
final int id;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import 'package:fooder_web/models/entry.dart';
|
||||
import 'package:fooder/models/entry.dart';
|
||||
|
||||
|
||||
class Meal {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:fooder_web/screens/based.dart';
|
||||
import 'package:fooder_web/models/product.dart';
|
||||
import 'package:fooder_web/models/diary.dart';
|
||||
import 'package:fooder_web/models/meal.dart';
|
||||
import 'package:fooder_web/widgets/product.dart';
|
||||
import 'package:fooder_web/screens/add_product.dart';
|
||||
import 'package:fooder/screens/based.dart';
|
||||
import 'package:fooder/models/product.dart';
|
||||
import 'package:fooder/models/diary.dart';
|
||||
import 'package:fooder/models/meal.dart';
|
||||
import 'package:fooder/widgets/product.dart';
|
||||
import 'package:fooder/screens/add_product.dart';
|
||||
|
||||
|
||||
class AddEntryScreen extends BasedScreen {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:fooder_web/screens/based.dart';
|
||||
import 'package:fooder_web/models/diary.dart';
|
||||
import 'package:fooder/screens/based.dart';
|
||||
import 'package:fooder/models/diary.dart';
|
||||
|
||||
|
||||
class AddMealScreen extends BasedScreen {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:fooder_web/screens/based.dart';
|
||||
import 'package:fooder_web/models/product.dart';
|
||||
import 'package:fooder/screens/based.dart';
|
||||
import 'package:fooder/models/product.dart';
|
||||
|
||||
|
||||
class AddProductScreen extends BasedScreen {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:fooder_web/client.dart';
|
||||
import 'package:fooder/client.dart';
|
||||
|
||||
|
||||
abstract class BasedScreen extends StatefulWidget {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:fooder_web/screens/based.dart';
|
||||
import 'package:fooder_web/models/product.dart';
|
||||
import 'package:fooder_web/models/entry.dart';
|
||||
import 'package:fooder_web/widgets/product.dart';
|
||||
import 'package:fooder_web/screens/add_product.dart';
|
||||
import 'package:fooder/screens/based.dart';
|
||||
import 'package:fooder/models/product.dart';
|
||||
import 'package:fooder/models/entry.dart';
|
||||
import 'package:fooder/widgets/product.dart';
|
||||
import 'package:fooder/screens/add_product.dart';
|
||||
|
||||
|
||||
class EditEntryScreen extends BasedScreen {
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:fooder_web/screens/based.dart';
|
||||
import 'package:fooder_web/screens/main.dart';
|
||||
import 'package:fooder_web/screens/register.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:fooder/screens/based.dart';
|
||||
import 'package:fooder/screens/main.dart';
|
||||
import 'package:fooder/screens/register.dart';
|
||||
|
||||
|
||||
class LoginScreen extends BasedScreen {
|
||||
|
@ -69,6 +70,13 @@ class _LoginScreen extends State<LoginScreen> {
|
|||
@override
|
||||
void initState () {
|
||||
super.initState();
|
||||
SystemChannels.textInput.invokeMethod('TextInput.setClientFeatures', <String, dynamic>{
|
||||
'setAuthenticationConfiguration': true,
|
||||
'setAutofillHints': <String>[
|
||||
AutofillHints.username,
|
||||
AutofillHints.password,
|
||||
],
|
||||
});
|
||||
_asyncInitState().then((value) => null);
|
||||
}
|
||||
|
||||
|
@ -105,6 +113,7 @@ class _LoginScreen extends State<LoginScreen> {
|
|||
labelText: 'Username',
|
||||
),
|
||||
controller: usernameController,
|
||||
autofillHints: const [AutofillHints.username],
|
||||
),
|
||||
TextFormField(
|
||||
obscureText: true,
|
||||
|
@ -112,7 +121,8 @@ class _LoginScreen extends State<LoginScreen> {
|
|||
labelText: 'Password',
|
||||
),
|
||||
controller: passwordController,
|
||||
onFieldSubmitted: (_) => _login()
|
||||
onFieldSubmitted: (_) => _login(),
|
||||
autofillHints: const [AutofillHints.password],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:fooder_web/screens/based.dart';
|
||||
import 'package:fooder_web/screens/login.dart';
|
||||
import 'package:fooder_web/screens/add_entry.dart';
|
||||
import 'package:fooder_web/models/diary.dart';
|
||||
import 'package:fooder_web/widgets/diary.dart';
|
||||
import 'package:fooder/screens/based.dart';
|
||||
import 'package:fooder/screens/login.dart';
|
||||
import 'package:fooder/screens/add_entry.dart';
|
||||
import 'package:fooder/models/diary.dart';
|
||||
import 'package:fooder/widgets/diary.dart';
|
||||
|
||||
|
||||
class MainScreen extends BasedScreen {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:fooder_web/screens/based.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:fooder/screens/based.dart';
|
||||
|
||||
|
||||
class RegisterScreen extends BasedScreen {
|
||||
|
@ -23,6 +24,18 @@ class _RegisterScreen extends State<RegisterScreen> {
|
|||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
SystemChannels.textInput.invokeMethod('TextInput.setClientFeatures', <String, dynamic>{
|
||||
'setAuthenticationConfiguration': true,
|
||||
'setAutofillHints': <String>[
|
||||
AutofillHints.username,
|
||||
AutofillHints.password,
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
void showError(String message)
|
||||
{
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
|
@ -85,6 +98,7 @@ class _RegisterScreen extends State<RegisterScreen> {
|
|||
labelText: 'Username',
|
||||
),
|
||||
controller: usernameController,
|
||||
autofillHints: const [AutofillHints.username],
|
||||
),
|
||||
TextFormField(
|
||||
obscureText: true,
|
||||
|
@ -92,6 +106,7 @@ class _RegisterScreen extends State<RegisterScreen> {
|
|||
labelText: 'Password',
|
||||
),
|
||||
controller: passwordController,
|
||||
autofillHints: const [AutofillHints.password],
|
||||
),
|
||||
TextFormField(
|
||||
obscureText: true,
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:fooder_web/models/diary.dart';
|
||||
import 'package:fooder_web/widgets/meal.dart';
|
||||
import 'package:fooder_web/widgets/macro.dart';
|
||||
import 'package:fooder_web/client.dart';
|
||||
import 'package:fooder_web/screens/add_meal.dart';
|
||||
import 'package:fooder/models/diary.dart';
|
||||
import 'package:fooder/widgets/meal.dart';
|
||||
import 'package:fooder/widgets/macro.dart';
|
||||
import 'package:fooder/client.dart';
|
||||
import 'package:fooder/screens/add_meal.dart';
|
||||
import 'dart:core';
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:fooder_web/models/entry.dart';
|
||||
import 'package:fooder_web/widgets/macro.dart';
|
||||
import 'package:fooder/models/entry.dart';
|
||||
import 'package:fooder/widgets/macro.dart';
|
||||
import 'dart:core';
|
||||
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:fooder_web/models/meal.dart';
|
||||
import 'package:fooder_web/widgets/entry.dart';
|
||||
import 'package:fooder_web/widgets/macro.dart';
|
||||
import 'package:fooder_web/screens/edit_entry.dart';
|
||||
import 'package:fooder_web/client.dart';
|
||||
import 'package:fooder/models/meal.dart';
|
||||
import 'package:fooder/widgets/entry.dart';
|
||||
import 'package:fooder/widgets/macro.dart';
|
||||
import 'package:fooder/screens/edit_entry.dart';
|
||||
import 'package:fooder/client.dart';
|
||||
import 'dart:core';
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:fooder_web/models/product.dart';
|
||||
import 'package:fooder_web/widgets/macro.dart';
|
||||
import 'package:fooder/models/product.dart';
|
||||
import 'package:fooder/widgets/macro.dart';
|
||||
import 'dart:core';
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: fooder_web
|
||||
description: A new Flutter project.
|
||||
name: fooder
|
||||
description: FOODER - no bloat food diary
|
||||
# The following line prevents the package from being accidentally published to
|
||||
# pub.dev using `flutter pub publish`. This is preferred for private packages.
|
||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
|
|
Loading…
Reference in a new issue