ve_alog 0.0.9 copy "ve_alog: ^0.0.9" to clipboard
ve_alog: ^0.0.9 copied to clipboard

A flutter plugin for veMars log recovery service.

example/lib/main.dart

import 'package:flutter/material.dart';

import 'package:ve_alog/ve_alog.dart';

const alog = VeAlogImpl.instance;

void main() {
  runApp(MyApp());
  alog.enable();
  alog.enableConsoleLog();
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        home: Scaffold(
      appBar: AppBar(
        title: const Text('通用版首页'),
        actions: <Widget>[
          IconButton(
            icon: const Icon(Icons.settings),
            tooltip: 'Setting',
            onPressed: () => Navigator.of(context).pushNamed('/setting'),
          ),
        ],
      ),
      body: Center(
        child: ListView(
          padding: const EdgeInsets.only(
              left: 16.0, right: 16.0, top: 8.0, bottom: 8.0),
          children: <Widget>[
            buildButton(context, '记录 debug 日志',
                () => alog.debug(tag: 'test', message: 'debug')),
            buildButton(context, '记录 info 日志',
                () => alog.info(tag: 'test', message: 'info')),
            buildButton(context, '记录 warn 日志',
                () => alog.warn(tag: 'test', message: 'warn')),
            buildButton(context, '记录 error 日志',
                () => alog.error(tag: 'test', message: 'error')),
          ],
        ),
      ),
    ));
  }
}

Widget buildButton(BuildContext context, String text, VoidCallback onPressed) {
  final TextStyle buttonTextStyle =
      Theme.of(context).textTheme.button ?? DefaultTextStyle.of(context).style;
  return Padding(
    padding: const EdgeInsets.only(
      top: 10,
      bottom: 10,
    ),
    child: SizedBox(
      width: double.infinity,
      child: ElevatedButton(
        child: Padding(
          padding: const EdgeInsets.all(8.0),
          child: Text(
            text,
            style: buttonTextStyle.copyWith(
              color: Colors.white,
              fontSize: 18,
            ),
          ),
        ),
        onPressed: onPressed,
      ),
    ),
  );
}
0
likes
110
pub points
6%
popularity

Publisher

verified publishervolcengine.com

A flutter plugin for veMars log recovery service.

Homepage

Documentation

API reference

License

unknown (license)

Dependencies

flutter

More

Packages that depend on ve_alog