mirror of
https://github.com/acamarata/qibla-dart.git
synced 2026-06-30 19:04:27 +00:00
docs: add wiki docs (P1)
This commit is contained in:
parent
5efc56bbea
commit
d89c0e6350
5 changed files with 176 additions and 0 deletions
34
.github/wiki/CODE_OF_CONDUCT.md
vendored
Normal file
34
.github/wiki/CODE_OF_CONDUCT.md
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
# Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as contributors and maintainers pledge to make participation in this project a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment:
|
||||
|
||||
- Using welcoming and inclusive language
|
||||
- Being respectful of differing viewpoints and experiences
|
||||
- Accepting constructive criticism gracefully
|
||||
- Focusing on what is best for the community
|
||||
- Showing empathy toward other community members
|
||||
|
||||
Examples of unacceptable behavior:
|
||||
|
||||
- Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
- Public or private harassment
|
||||
- Publishing others' private information without explicit permission
|
||||
- Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable behavior. They will take appropriate and fair corrective action in response to any behavior they deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project maintainer at alisalaah@gmail.com. All complaints will be reviewed and investigated. The project team is obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1, available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.
|
||||
27
.github/wiki/SECURITY.md
vendored
Normal file
27
.github/wiki/SECURITY.md
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# Security
|
||||
|
||||
## Scope
|
||||
|
||||
`qibla` is a pure-math library with no network access, no file I/O, and no external dependencies. The attack surface is limited to the mathematical functions themselves.
|
||||
|
||||
The main concern is input validation: `qiblaAngle` and `qiblaGreatCircle` throw `RangeError` on out-of-bounds coordinates. If you pass untrusted input to these functions, catch the error.
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
If you discover a security issue (for example, a case where malformed input causes unexpected behavior beyond the documented `RangeError`), please report it privately before filing a public issue.
|
||||
|
||||
**Contact:** alisalaah@gmail.com
|
||||
|
||||
Include:
|
||||
|
||||
1. A description of the vulnerability
|
||||
2. Steps to reproduce it
|
||||
3. The version of `qibla` where you observed the issue
|
||||
4. Any suggested fix if you have one
|
||||
|
||||
You can expect an acknowledgment within 48 hours and a resolution or status update within 7 days.
|
||||
|
||||
## Known Limitations
|
||||
|
||||
- `distanceKm` uses a spherical Earth model (R = 6,371 km). It does not account for Earth's ellipsoidal shape. For high-precision geodesy, use a WGS-84 library.
|
||||
- Ka'bah coordinates are fixed constants. They will not change unless there is a documented scholarly correction to the GPS position.
|
||||
3
.github/wiki/_Footer.md
vendored
Normal file
3
.github/wiki/_Footer.md
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
[](https://pub.dev/packages/qibla) [](https://github.com/acamarata/qibla-dart/blob/main/LICENSE)
|
||||
|
||||
[pub.dev](https://pub.dev/packages/qibla) | [GitHub](https://github.com/acamarata/qibla-dart) | [Issues](https://github.com/acamarata/qibla-dart/issues)
|
||||
20
.github/wiki/_Sidebar.md
vendored
Normal file
20
.github/wiki/_Sidebar.md
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
## qibla
|
||||
|
||||
- [Home](Home)
|
||||
- [API Reference](API-Reference)
|
||||
|
||||
**Guides**
|
||||
- [Quickstart](guides/quickstart)
|
||||
- [Advanced Usage](guides/advanced)
|
||||
|
||||
**Examples**
|
||||
- [Basic Usage](examples/basic-usage)
|
||||
- [Flutter Integration](examples/flutter-integration)
|
||||
|
||||
**Project**
|
||||
- [Code of Conduct](CODE_OF_CONDUCT)
|
||||
- [Security](SECURITY)
|
||||
|
||||
---
|
||||
|
||||
[pub.dev](https://pub.dev/packages/qibla) | [GitHub](https://github.com/acamarata/qibla-dart)
|
||||
92
.github/wiki/examples/flutter-integration.md
vendored
Normal file
92
.github/wiki/examples/flutter-integration.md
vendored
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
# Flutter Integration
|
||||
|
||||
This example shows how to use `qibla` in a Flutter widget. It reads the device's current location using `geolocator`, computes the Qibla bearing, and displays the result.
|
||||
|
||||
## Dependencies
|
||||
|
||||
Add to `pubspec.yaml`:
|
||||
|
||||
```yaml
|
||||
dependencies:
|
||||
qibla: ^1.0.0
|
||||
geolocator: ^14.0.0
|
||||
```
|
||||
|
||||
## QiblaCard Widget
|
||||
|
||||
```dart
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:qibla/qibla.dart';
|
||||
|
||||
class QiblaCard extends StatefulWidget {
|
||||
const QiblaCard({super.key});
|
||||
|
||||
@override
|
||||
State<QiblaCard> createState() => _QiblaCardState();
|
||||
}
|
||||
|
||||
class _QiblaCardState extends State<QiblaCard> {
|
||||
double? _bearing;
|
||||
String? _error;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_loadQibla();
|
||||
}
|
||||
|
||||
Future<void> _loadQibla() async {
|
||||
try {
|
||||
final permission = await Geolocator.requestPermission();
|
||||
if (permission == LocationPermission.denied ||
|
||||
permission == LocationPermission.deniedForever) {
|
||||
setState(() => _error = 'Location permission denied.');
|
||||
return;
|
||||
}
|
||||
|
||||
final pos = await Geolocator.getCurrentPosition();
|
||||
final bearing = qiblaAngle(pos.latitude, pos.longitude);
|
||||
setState(() => _bearing = bearing);
|
||||
} catch (e) {
|
||||
setState(() => _error = e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (_error != null) {
|
||||
return Text('Error: $_error');
|
||||
}
|
||||
if (_bearing == null) {
|
||||
return const CircularProgressIndicator();
|
||||
}
|
||||
|
||||
final dir = compassName(_bearing!);
|
||||
return Card(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
'${_bearing!.toStringAsFixed(1)}°',
|
||||
style: Theme.of(context).textTheme.displayMedium,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(dir, style: Theme.of(context).textTheme.titleMedium),
|
||||
const SizedBox(height: 8),
|
||||
const Text('Qibla bearing from your location'),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- `qiblaAngle` and `compassName` are pure functions. They do not require any platform channel or plugin; the only async work is the location request.
|
||||
- The bearing is in degrees clockwise from true north. To rotate a compass needle image, use a `Transform.rotate` widget with `angle = bearing * (pi / 180)`.
|
||||
- For a live compass, combine the bearing with a magnetometer reading from `flutter_compass` to subtract the device heading.
|
||||
Loading…
Reference in a new issue