mirrored_repositories/Aplikasi-Manajemen-Keuangan-v2/lib
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:url_launcher/url_launcher.dart';

class LastUpdate extends StatelessWidget {
  final String date;

  LastUpdate({required this.date});

  @override
  Widget build(BuildContext context) {
    return Column(
      children: <Widget>[
        Padding(
          padding: const EdgeInsets.only(right: 16, top: 24, bottom: 4),
          child: Row(
            crossAxisAlignment: CrossAxisAlignment.end,
            mainAxisAlignment: MainAxisAlignment.end,
            children: <Widget>[
              Icon(
                Icons.date_range,
                color: Colors.black26,
                size: 16,
              ),
              Padding(
                padding: const EdgeInsets.only(left: 4),
                child: Text(
                  "Last Update ${DateFormat('dd MMMM yyyy').format(DateTime.parse(date))}",
                  textAlign: TextAlign.center,
                  style: TextStyle(color: Colors.black38),
                ),
              ),
            ],
          ),
        ),
        Container(
          width: double.infinity,
          padding: const EdgeInsets.only(right: 16),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.end,
            mainAxisSize: MainAxisSize.max,
            children: <Widget>[
              Text('NoirDev', style: TextStyle(color: Colors.black54)),
              GestureDetector(
                onTap: () {
                  _launchURL('https://jojo.tirtagt.xyz/#project');
                },
                child: Text(
                  'NoirDev',
                  style: TextStyle(fontSize: 13, color: Colors.lightBlueAccent),
                ),
              ),
            ],
          ),
        )
      ],
    );
  }

  _launchURL(String url) async {
    Uri urlUri = Uri.parse(url);
    if (await canLaunchUrl(urlUri)) {
      await launchUrl(urlUri);
    } else {
      throw 'Could not launch $url';
    }
  }
}