Skip to content
Snippets Groups Projects
Select Git revision
  • 991eebb496be2011574d1a9a3733cde9bf703d60
  • master default protected
  • 61-upgrade-framework-and-dependencies
  • 42-improve-app-metadata
  • 17-improve-and-complete-offline-words-list-and-tips
  • 6-allow-translate-application
  • 9-improve-documentation
  • Release_1.10.0_44 protected
  • Release_1.9.2_43 protected
  • Release_1.9.1_42 protected
  • Release_1.9.0_41 protected
  • Release_1.8.0_40 protected
  • Release_1.7.0_39 protected
  • Release_1.6.0_38 protected
  • Release_1.5.2_37 protected
  • Release_1.5.1_36 protected
  • Release_1.5.0_35 protected
  • Release_1.4.1_34 protected
  • Release_1.4.0_33 protected
  • Release_1.3.2_32 protected
  • Release_1.3.1_31 protected
  • Release_1.3.0_30 protected
  • Release_1.2.18_29 protected
  • Release_1.2.17_28 protected
  • Release_1.2.16_27 protected
  • Release_1.2.15_26 protected
  • Release_1.2.14_25 protected
27 results

home.dart

Blame
  • home.dart 7.08 KiB
    import 'package:flutter/material.dart';
    import 'package:provider/provider.dart';
    
    import '../provider/data.dart';
    import 'game.dart';
    import '../widgets/my_app_bar.dart';
    import '../widgets/dialog_fetch_error.dart';
    import '../utils/constants.dart';
    
    class Home extends StatelessWidget {
      static const String id = 'home';
    
      @override
      Widget build(BuildContext context) {
        Orientation orientation = MediaQuery.of(context).orientation;
        Data _myProvider = Provider.of<Data>(context);
    
        List<Widget> _listWidgets() {
          return [
            Image.asset(
              'assets/images/icon128.png',
              scale: orientation == Orientation.portrait ? 1 : 1.5,
            ),
            Padding(
              padding: orientation == Orientation.portrait
                  ? EdgeInsets.only(top: 10.0)
                  : EdgeInsets.only(left: 10.0),
              child: Text(
                'Version: ${_myProvider.version}',
                textAlign: orientation == Orientation.portrait ? TextAlign.center : TextAlign.left,
              ),
            ),
          ];
        }
    
        void _errorWord(context) {
          showDialog(
            context: context,
            builder: (_) => AlertDialog(
              title: Text('Erreur inattendue'),
              content: Text('Erreur inattendue à la récupération d\'un mot aléatoire.\n'
                  'Installer une nouvelle version de l\'application pourrait corriger cette anomalie.'),
              actions: <Widget>[
                FlatButton(
                  child: Text('Fermer'),
                  onPressed: () => Navigator.of(context).pop(),
                )
              ],
            ),
          );
        }
    
        return Scaffold(
          appBar: MyAppBar(appBar: AppBar()),
          body: Builder(
            builder: (context) => Center(
              child: _myProvider.searching == true
                  ? WillPopScope(
                      onWillPop: () async => false,
                      child: Center(
                        child: CircularProgressIndicator(),
                        /*child: Text(
                          'Generando una palabra,\nespera un momento por favor...',
                          textAlign: TextAlign.center,
                        ),*/
                      ),
                    )
                  : Container(
                      child: SingleChildScrollView(
                        child: SizedBox(