chobilib_flutter 0.4.17
chobilib_flutter: ^0.4.17 copied to clipboard
A flutter package includes basic functions for various use
example/lib/main.dart
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:chobilib_flutter/chobilib_flutter.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> with TickerProviderStateMixin {
String _platformVersion = 'Unknown';
late final AnimationController _testAnimationController;
@override
void initState() {
super.initState();
_testAnimationController = AnimationController(
duration: const Duration(milliseconds: 150),
vsync: this,
);
WidgetsBinding.instance.addPostFrameCallback((_) async {
final rs = RandomString.withDigitsChars();
debugPrint(rs.getRandomString(20));
});
}
@override
void dispose() {
_testAnimationController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
//child: Text('Running on: $_platformVersion\n'),
child: Column(
children: [
Shaker(
animation: _testAnimationController,
builder: (context, value) {
return Container(
width: 128,
height: 32,
color: Colors.blue,
);
},
),
Gaps.vertical48,
TextButton(
onPressed: () {
_testAnimationController.forward(from: 0.0);
},
child: Text("animate"),
),
],
),
),
),
);
}
}