Skip to content

Commit

Permalink
🔖 Initial release 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
iqfareez committed Jun 26, 2022
1 parent 63b20e4 commit 05c8830
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 55 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
## 0.0.1
## 1.0.0

* TODO: Describe initial release.
- :tada: Initial release. Comes with classic, pastel and solid admonitions.
22 changes: 21 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
TODO: Add your license here.
MIT License

Copyright (c) 2022 Muhammad Fareez Iqmal

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
31 changes: 8 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,22 @@ and the Flutter guide for
[developing packages and plugins](https://flutter.dev/developing-packages).
-->

TODO: Put a short description of the package here that helps potential users
know whether this package might be useful for them.
A nice-looking banner-like widget to display messages, warnings, info etc.

Inspired by [**Docusaurus's admonitions**](https://docusaurus.io/docs/markdown-features/admonitions)

## Features

TODO: List what your package can do. Maybe include images, gifs, or videos.
Comes with **three (3)** available styles:

![admonition screenshot](https://imgur.com/6AIaCUr.png)
- Solid
- Pastel
- Classic

## Demo

https://flutter-admonitions.web.app/#/
Try the live demo here: :sparkles: **https://flutter-admonitions.web.app** :sparkles:

## Getting started
## Example

TODO: List prerequisites and provide or point to information on how to
start using the package.

## Usage

TODO: Include short and useful examples for package users. Add longer examples
to `/example` folder.

```dart
const like = 'sample';
```

## Additional information

TODO: Tell users more about the package: where to find more information, how to
contribute to the package, how to file issues, what response they can expect
from the package authors, and more.
View **example** section, or visit GitHub and navigate to `/example` folder.
2 changes: 2 additions & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class _MyAppState extends State<MyApp> {
title: const Text('Admonition Demo'),
actions: [
IconButton(
tooltip: "Toggle light/dark theme",
onPressed: () {
setState(() {
_theme = _theme == ThemeMode.light
Expand Down Expand Up @@ -136,6 +137,7 @@ class MyHomePage extends StatelessWidget {
child: const Text('Action 2'))
],
),
const Divider(),
Text(
'Classic Admonitions',
style: Theme.of(context).textTheme.headline6,
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.0.1"
version: "1.0.0"
async:
dependency: transitive
description:
Expand Down
24 changes: 0 additions & 24 deletions example/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,30 +102,6 @@
loadMainDartJs();
}
</script>

<script type="module">
// Import the functions you need from the SDKs you need
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.8.0/firebase-app.js";
import { getAnalytics } from "https://www.gstatic.com/firebasejs/9.8.0/firebase-analytics.js";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries

// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
apiKey: "AIzaSyDxlv9QogOjpsicX5g18vwumnhS5WLXrl8",
authDomain: "flutter-admonitions.firebaseapp.com",
projectId: "flutter-admonitions",
storageBucket: "flutter-admonitions.appspot.com",
messagingSenderId: "117655787266",
appId: "1:117655787266:web:7d4afb3d6b6af6d990541b",
measurementId: "G-WC906DQVTK"
};

// Initialize Firebase
const app = initializeApp(firebaseConfig);
const analytics = getAnalytics(app);
</script>
</body>

</html>
21 changes: 20 additions & 1 deletion lib/src/classic.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,37 @@ class ClassicAdmonition extends StatelessWidget {
this.primaryColor,
}) : super(key: key);

/// Text that will be displayed in the admonition.
final String? text;

/// The child widget that will be displayed in the admonition.
/// To use [child], [text] must be null.
final Widget? child;

/// Colour of the admonition.
final Color? color;

/// The leading icon of the admonition.
/// Overrides the default icon
final Widget? icon;

/// Colour background opacity
/// value between 0 and 1
final double opacity;

/// Colour of the [text] and [icon]
final Color? primaryColor;

/// List of widgets to be displayed at the end of the adminitions.
/// If [actions] is null, the admonition will be displayed without actions.
/// Usually will be TextButton(s).
///
/// Button Style parameter you can follow:
/// ```dart
/// tapTargetSize: MaterialTapTargetSize.shrinkWrap,
/// primary: Theme.of(context).textTheme.bodyLarge!.color,
/// textStyle: const TextStyle(fontWeight: FontWeight.w600),
/// ```
final List<Widget>? actions;

@override
Expand All @@ -91,7 +110,7 @@ class ClassicAdmonition extends StatelessWidget {
borderRadius: BorderRadius.circular(16),
child: Stack(children: [
Positioned.fromRect(
rect: Rect.fromLTRB(0, 0, 8, 400),
rect: const Rect.fromLTRB(0, 0, 8, 400),
child: Container(
color: color,
// constraints: BoxConstraints.expand(),
Expand Down
19 changes: 19 additions & 0 deletions lib/src/pastel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,37 @@ class PastelAdmonition extends StatelessWidget {
this.primaryColor,
}) : super(key: key);

/// Text inside the admonition
final String? text;

/// Widget to replace Text widget inside admonitions
/// To use [child], [text] must be null.
final Widget? child;

/// Base colour of the admonition
/// [opacity] value will be applied to this [color]
final Color? color;

/// Leading icon for admonition
final Widget? icon;

/// opacity of the admonition.
/// Value between 0 and 1.
final double opacity;

/// Primary colour of the admonitions
final Color? primaryColor;

/// List of widgets to be displayed at the end of the adminitions.
/// If [actions] is null, the admonition will be displayed without actions.
/// Usually will be TextButton(s)
///
/// Button Style parameter you can follow:
/// ```dart
/// tapTargetSize: MaterialTapTargetSize.shrinkWrap,
/// primary: Theme.of(context).textTheme.bodyLarge!.color,
/// textStyle: const TextStyle(fontWeight: FontWeight.w600),
/// ```
final List<Widget>? actions;

@override
Expand Down
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: admonitions
description: A new Flutter package project.
version: 0.0.1
homepage:
description: A nice looking banner for hints, warnings, messages etc.
version: 1.0.0
homepage: https://github.com/iqfareez/admonitions

environment:
sdk: ">=2.16.2 <3.0.0"
Expand Down

0 comments on commit 05c8830

Please sign in to comment.