Skip to content

zelonware/mobileWars

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

this is...

mobile wars!

testing and fooling aroud with mobile frameworks

Flutter

Proyectos

Repos:

Code snippets

CircleAvatar:

 CircleAvatar(
            radius: 50,
            backgroundColor: Colors.black,
            backgroundImage: NetworkImage('coolimage'),
          ),

Card:

 Card(
              color: Colors.white,
              margin: EdgeInsets.symmetric(vertical: 10, horizontal: 25),
              child: ListTile(
                leading: Icon(Icons.phone),
                iconColor: Colors.deepPurpleAccent,
                title: Text(
                  '+34 666 666 666',
                  style: TextStyle(
                      color: Colors.deepPurpleAccent,
                      fontSize: 14,
                      fontFamily: 'SourceSansPro'),
                ),
              )),

SizedBox:

SizedBox(
          height: 40,
          width: 40,
          child: ClipRRect(
            borderRadius: BorderRadius.circular(20),
            child: Image.network('url'),
          ),
        )

Importar fuentes e imágenes:

flutter:

  uses-material-design: true
    - images/image.jpeg

  fonts:
    - family: Pacifico
      fonts:
        - asset: fonts/Pacifico-Regular.ttf
    - family: SourceSansPro
      fonts:
        - asset: fonts/SourceSansPro-Regular.ttf

Número aleatorio entre 1 y 6:

Random().nextInt(6) + 1;

Estructura básica:

import 'package:flutter/material.dart';
import 'input_page.dart';

void main() => runApp(PizzaCalculator());

class PizzaCalculator extends StatelessWidget {
  var backgroundColor = Color(0xFF090C22);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData.dark().copyWith(
        primaryColor: backgroundColor,
        scaffoldBackgroundColor: backgroundColor,
        appBarTheme: AppBarTheme(
          backgroundColor: backgroundColor
        )
      ),
      home: InputPage(),
    );
  }
}

alertDialog:

Future<String> buildShowDialog(BuildContext context) {
    return showDialog<String>(
      context: context,
      builder: (BuildContext context) => AlertDialog(
        title: const Text('No flavour selected'),
        content: const Text('Please select a pizza flavour'),
        actions: <Widget>[
          TextButton(
            onPressed: () => Navigator.pop(context, 'OK'),
            child: const Text('OK'),
          ),
        ],
      ),
    );
  }

Useful links