hello_world_lib 1.0.1
hello_world_lib: ^1.0.1 copied to clipboard
A simple Hello World library for Flutter
Hello World Lib #
A simple and easy-to-use Flutter library that provides Hello World functionality with customizable greetings and ready-to-use widgets.
Features #
- Simple Greetings: Generate basic "Hello, World!" messages
- Personalized Greetings: Create custom greetings with names
- Time-based Greetings: Include current time in your greetings
- Flutter Widget: Ready-to-use widget for easy integration
- Lightweight: Minimal dependencies and small package size
- Well Tested: Comprehensive test coverage
Getting Started #
Add this package to your Flutter project by including it in your pubspec.yaml:
dependencies:
hello_world_lib: ^1.0.0
Then run:
flutter pub get
Usage #
Basic Usage #
Import the package and use the HelloWorld class:
import 'package:hello_world_lib/hello_world_lib.dart';
// Simple greeting
String greeting = HelloWorld.getGreeting();
print(greeting); // Output: Hello, World!
// Personalized greeting
String personalGreeting = HelloWorld.getGreeting('Flutter Developer');
print(personalGreeting); // Output: Hello, Flutter Developer!
// Greeting with current time
String timeGreeting = HelloWorld.getGreetingWithTime('World');
print(timeGreeting); // Output: Hello, World! Current time: 14:30:25
Using the Widget #
Use the HelloWorldWidget in your Flutter UI:
import 'package:flutter/material.dart';
import 'package:hello_world_lib/hello_world_lib.dart';
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: Text('Hello World Example')),
body: Column(
children: [
// Basic widget
HelloWorldWidget(),
// Customized widget
HelloWorldWidget(
name: 'Flutter Developer',
textStyle: TextStyle(
fontSize: 20,
color: Colors.blue,
fontWeight: FontWeight.bold,
),
),
// Widget with time
HelloWorldWidget(
name: 'World',
showTime: true,
textStyle: TextStyle(fontSize: 18, color: Colors.green),
),
],
),
),
);
}
}
API Reference #
HelloWorld Class #
Methods
static String getGreeting([String? name])- Returns a greeting message. If name is provided, returns personalized greeting.static String getGreetingWithTime([String? name])- Returns a greeting message with current time included.
HelloWorldWidget #
Properties
String? name- Optional name for personalized greetingTextStyle? textStyle- Custom text styling for the greetingbool showTime- Whether to include current time (default: false)
Example #
Check out the example directory for a complete Flutter app demonstrating all features of this library.
To run the example:
cd example
flutter run
Additional Information #
Contributing #
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
Issues #
If you encounter any issues or have feature requests, please file them in the GitHub Issues section.
License #
This project is licensed under the MIT License - see the LICENSE file for details.
Changelog #
See CHANGELOG.md for a detailed list of changes and version history.
Support #
For questions and support, please create an issue on GitHub or reach out through the repository's discussion section.