awesome_icons 1.1.0 copy "awesome_icons: ^1.1.0" to clipboard
awesome_icons: ^1.1.0 copied to clipboard

Font Awesome 5 For Flutter

example/lib/main.dart

import 'package:flutter/material.dart';

import 'package:awesome_icons/awesome_icons.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Awesome Icons',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Awesome Icons'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    List<String> keys = fontAwesomeIcons.keys.toList();

    return Scaffold(
      appBar: AppBar(
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: Text(widget.title),
      ),
      body: GridView.builder(
        gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
          crossAxisCount: 2,
          crossAxisSpacing: 8.0,
        ),
        itemBuilder: (BuildContext context, int index) {
          return IconCard(
            icon: keys[index],
          );
        },
        itemCount: keys.length,
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

class IconCard extends StatelessWidget {
  final String icon;

  const IconCard({Key? key, required this.icon}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Card(
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
          Icon(
            fontAwesomeIcons[icon],
            size: 24.0,
          ),
          const SizedBox(height: 30.0),
          Text(icon)
        ],
      ),
    );
  }
}
11
likes
100
pub points
93%
popularity

Publisher

verified publisherappcheap.io

Font Awesome 5 For Flutter

Homepage

Documentation

API reference

License

unknown (LICENSE)

Dependencies

flutter, recase

More

Packages that depend on awesome_icons