Icon

Icon

Icon( Icons.call_made )

açıklama

İkonları göstermek için pratik bir widget.

konum

MaterialApp({ title,theme, home: Scaffold({ appBar, body: Center(child:Icon( Icons.call_made )), }), })

parametreler

Icon( Icons.call_made )

örnek uygulama

font-icons-screenshot-orn
 

import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:boxicons_flutter/boxicons_flutter.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Use Font Icons',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Font Icons'),
    );
  }
}

class MyHomePage extends StatelessWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(title),
      ),
      body: Center(
        child: ListView(
          children: [
            IconWidget(
              Icons.alarm,
              'Material design',
            ),
            IconWidget(
              FontAwesomeIcons.angry,
              'Font Awesome',
            ),
            IconWidget(
              IconData(0xeb03, fontFamily: 'Boxicons'),
              'Boxicons',
            ),
            IconWidget(
              Boxicons.bxBall,
              'Boxicons (boxicons_flutter)',
            )
          ],
        ),
      ),
    );
  }
}

class IconWidget extends StatelessWidget {
  IconWidget(this.iconData, this.description);

  final IconData iconData;
  final String description;

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Column(
        children: [
          Padding(
            padding: EdgeInsets.all(10),
          ),
          Icon(
            iconData,
            size: 120,
          ),
          Text(description),
        ],
      ),
    );
  }
}

 dosya adı: pubspec.yaml

name: flutter_use_font_icons
description: Use font icons in Flutter

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# Read more about versioning at semver.org.
version: 1.0.0+1

environment:
  sdk: ">=2.0.0-dev.68.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2

  font_awesome_flutter: ^8.2.0
  boxicons_flutter: ^1.0.0

dev_dependencies:
  flutter_test:
    sdk: flutter


# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  fonts:
    - family: Boxicons
      fonts:
        - asset: fonts/boxicons.ttf
          weight: 400

“fonts/” kasör dizinine boxicons.ttf fontunu indirip atınız.
GitHup proje linki

Bir cevap yazın

KAPAT
%d blogcu bunu beğendi: