git_stamp 5.8.1 copy "git_stamp: ^5.8.1" to clipboard
git_stamp: ^5.8.1 copied to clipboard

Advanced await-less information provider. From simple information such as build-branch to a screen with Flutter code with commits and change history.

example/lib/main.dart

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

import 'package:google_fonts/google_fonts.dart';

import 'git_stamp/git_stamp.dart';

String? get monospaceFontFamily {
  /// Don't forget about the font's open source license terms in Your App:
  /// https://pub.dev/packages/google_fonts#licensing-fonts
  return kIsWeb ? GoogleFonts.sourceCodePro().fontFamily : 'SourceCodePro';
}

void main() {
  /// Copyright's :O
  LicenseRegistry.addLicense(() async* {
    final license = await rootBundle.loadString('google_fonts/OFL.txt');
    yield LicenseEntryWithLineBreaks(['google_fonts'], license);
  });

  runApp(ExampleApp());
}

class ExampleApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: MainPage(),
      themeMode: ThemeMode.system,
      theme: ThemeData.light(),
      darkTheme: ThemeData.dark(),
      debugShowCheckedModeBanner: false,
    );
  }
}

class MainPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Example App'),
        actions: [
          IconButton(
            icon: Icon(Icons.settings),
            onPressed: () => navigateToSettings(context),
          ),
        ],
      ),
      body: Center(
        child: Text(
          'Example app',
          style: Theme.of(context).textTheme.headlineMedium,
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () => navigateToSettings(context),
        child: const Icon(Icons.add),
      ),
    );
  }

  static void navigateToSettings(BuildContext context) {
    Navigator.push(
      context,
      MaterialPageRoute(builder: (context) => SettingsPage()),
    );
  }
}

class SettingsPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Settings Page'),
        actions: [
          GitStamp.icon(),
        ],
      ),
      body: Column(
        children: [
          FutureBuilder<int>(
            future: LicenseRegistry.licenses.length,
            builder: (BuildContext context, AsyncSnapshot<int> snapshot) {
              return ListTile(
                title: Text('Open Source Licenses'),
                subtitle: Text(snapshot.data?.toString() ?? 'Loading'),
                leading: const Icon(Icons.gavel),
                onTap: () => GitStamp.showLicensePage(context: context),
              );
            },
          ),
          ListTile(
            title: Text('Version'),
            subtitle: Text(GitStamp.appVersion),
            leading: const Icon(Icons.numbers),
            onTap: () {},
          ),
          GitStamp.listTile(
            context: context,
            monospaceFontFamily: monospaceFontFamily,
          ),
        ],
      ),
    );
  }
}
49
likes
0
points
2.03k
downloads

Publisher

verified publisheraroncode.com

Weekly Downloads

Advanced await-less information provider. From simple information such as build-branch to a screen with Flutter code with commits and change history.

Homepage
Repository (GitHub)
View/report issues

Topics

#git #git-history #git-integration #tool #codegen

Documentation

Documentation

License

unknown (license)

Dependencies

args, aron_gradient_line, collection, encrypt, flutter, intl, meta, pub_semver, pubspec_parse, url_launcher

More

Packages that depend on git_stamp