Flutter UI #51: Fun with Instagram Mention in Flutter


Flutter UI #51: Fun with Instagram Mention in Flutter

Tutorial and code of Instagram Mention in Flutter. Copy and paste the below code as per your requirements.

instagram_mention: ^1.0.0+2

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Instagram Mention',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: const MyHomePage(title: 'Instagram Mention'),
    );
  }
}

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

  final String? title;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Center(child: Text(title!),),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          mainAxisSize: MainAxisSize.min,
          children: <Widget>[
            InstagramMention(text: 'Nilen Patel'),
            const SizedBox(height: 75),
            InstagramMentionWithAvatar(
              image: Image.network('https://lh3.googleusercontent.com/-aVUDHl88ntw/AAAAAAAAAAI/AAAAAAAAAAA/WTiM4jCKjbo/s60-c-k-mo/photo.jpg'),
              text: 'Nilen Patel Inc.',
            )
          ],
        ),
      ),
    );
  }
}

Leave a Reply

Your email address will not be published.