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

outdated

A flutter plugin for veMars log recovery service.

example/lib/main.dart

import 'package:flutter/material.dart';

import 'package:ve_onekit/services/services.dart';

import 'main.startup.dart';

void main() {
  runOneKitApp(() => MyApp());
}

class MyApp extends StatelessWidget {
  MyApp({Key? key}) : super(key: key);
  final _alog = serviceManager.getService<VeAlog>()!..enableConsoleLog();
  @override
  Widget build(BuildContext context) => 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, right: 16, top: 8, bottom: 8),
            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 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(
        onPressed: onPressed,
        child: Padding(
          padding: const EdgeInsets.all(8),
          child: Text(
            text,
            style: buttonTextStyle.copyWith(
              color: Colors.white,
              fontSize: 18,
            ),
          ),
        ),
      ),
    ),
  );
}
0
likes
0
pub points
6%
popularity

Publisher

verified publishervolcengine.com

A flutter plugin for veMars log recovery service.

Homepage

License

unknown (license)

Dependencies

flutter, ve_code_gen, ve_onekit

More

Packages that depend on ve_alog