matrix_link_text 2.0.0 copy "matrix_link_text: ^2.0.0" to clipboard
matrix_link_text: ^2.0.0 copied to clipboard

Easy to use text widget for Flutter apps, which converts inlined urls into working, clickable links. Allows for custom styling. Supports matrix identifiers

example/lib/main.dart

//  Copyright (c) 2019 Aleksander Woźniak
//  Licensed under Apache License v2.0

import 'package:flutter/material.dart';
import 'package:matrix_link_text/link_text.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: 'LinkText Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'LinkText Demo'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  final String title;

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

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

class _MyHomePageState extends State<MyHomePage> {
  final String _text =
      'Lorem ipsum https://flutter.dev\nhttps://pub.dev dolor https://google.com sit amet. At 8:00 AM';

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Padding(
          padding: const EdgeInsets.symmetric(horizontal: 20.0),
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              const SizedBox(height: 24.0),
              _buildNormalText(),
              const SizedBox(height: 64.0),
              _buildLinkText(),
              const SizedBox(height: 24.0),
            ],
          ),
        ),
      ),
    );
  }

  Widget _buildNormalText() {
    return Column(
      mainAxisSize: MainAxisSize.min,
      children: <Widget>[
        Text(
          'Normal Text Widget',
          textAlign: TextAlign.center,
          style: const TextStyle().copyWith(fontWeight: FontWeight.bold),
        ),
        const SizedBox(height: 12.0),
        Text(_text, textAlign: TextAlign.center),
      ],
    );
  }

  Widget _buildLinkText() {
    return Column(
      mainAxisSize: MainAxisSize.min,
      children: <Widget>[
        Text(
          'LinkText Widget',
          textAlign: TextAlign.center,
          style: const TextStyle().copyWith(fontWeight: FontWeight.bold),
        ),
        const SizedBox(height: 12.0),
        LinkText(text: _text, textAlign: TextAlign.center),
      ],
    );
  }
}
3
likes
120
pub points
80%
popularity

Publisher

unverified uploader

Easy to use text widget for Flutter apps, which converts inlined urls into working, clickable links. Allows for custom styling. Supports matrix identifiers

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (LICENSE)

Dependencies

flutter, url_launcher

More

Packages that depend on matrix_link_text