live_text 0.0.3 live_text: ^0.0.3 copied to clipboard
A flutter package that provides easiest way to update text widget in UI.
import 'package:example/counter_example.dart';
import 'package:example/example_enum.dart';
import 'package:example/timer_example.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Live Text Example',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: MyHomePage(
exampleType: ExampleEnum.timer,
),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({super.key, required this.exampleType});
ExampleEnum exampleType;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return widget.exampleType == ExampleEnum.counter
? CounterExample()
: TimerExample();
}
}