This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:math'; | |
| import 'package:flutter/material.dart'; | |
| void main() => runApp(MyApp()); | |
| class MyApp extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( | |
| debugShowCheckedModeBanner: false, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:developer'; | |
| import 'dart:io'; | |
| import 'package:yaml/yaml.dart'; | |
| import 'package:yaml_writer/yaml_writer.dart'; | |
| /// Run by calling dart increment_version.dart major/minor/patch | |
| void main(List<String> args) { | |
| // Use the provided argument to determine the version type to increment, | |
| // or default to minor if no argument is provided |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:convert'; | |
| import 'package:json_annotation/json_annotation.dart'; | |
| class IntListConverter implements JsonConverter<List<int>?, String> { | |
| const IntListConverter(); | |
| @override | |
| List<int>? fromJson(String? json) => List<int>.from(jsonDecode(json ?? '[]').map((e) => e.toInt())); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bool confirm = await showDialog<bool>( | |
| context: context, | |
| builder: (context) { | |
| return AlertDialog( | |
| title: const Text('Are you sure?'), | |
| content: const Text('This action cannot be undone.'), | |
| actions: [ | |
| TextButton( | |
| child: const Text('Cancel'), | |
| onPressed: (){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// Get the color from a gradient at a specific position | |
| /// Position should be between 0 and 1 | |
| extension ColorGetter on Gradient { | |
| Color? colorAtPosition({ | |
| required double position, | |
| }) { | |
| List<double> _stops = stops ?? List.generate(colors.length, (index) => index * (1 / (colors.length-1))); | |
| for (var stop = 0; stop < _stops.length - 1; stop++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class FirstTimeView extends HookWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| TickerProvider tickerProvider = useSingleTickerProvider(); | |
| return ViewModelBuilder<FirstTimeViewModel>.reactive( | |
| viewModelBuilder: () => FirstTimeViewModel(tickerProvider), | |
| builder: (context, model, child) { | |
| return Scaffold( | |
| appBar: AppBar( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// Get the color from a gradient at a specific position | |
| Color? colorAlongGradient({ | |
| required List<Color> colors, | |
| List<double>? stops, | |
| required double position, | |
| }) { | |
| stops ??= List.generate(colors.length, (index) => index * (1 / (colors.length-1))); | |
| for (var s = 0; s < stops.length - 1; s++) { | |
| final leftStop = stops[s], rightStop = stops[s + 1]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DefaultTabController( | |
| length: 4, | |
| child: Scaffold( | |
| appBar: AppBar( | |
| bottom: const TabBar( | |
| tabs: [ | |
| Tab(icon: Icon(Icons.home),), | |
| Tab(icon: Icon(Icons.whatshot),), | |
| Tab(icon: Icon(Icons.person),), | |
| Tab(icon: Icon(Icons.menu),), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Future<bool> askConfirmation({ | |
| required BuildContext context, | |
| required String title, | |
| String yes = 'Continue', | |
| String no = 'Cancel', | |
| }) async { | |
| return await showDialog( | |
| context: context, | |
| builder: (context) { | |
| return AlertDialog( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| GestureDetector( | |
| onTap: () { | |
| model.setInteraction(false); | |
| }, | |
| behavior: HitTestBehavior.deferToChild, | |
| child: InteractiveViewer( | |
| panEnabled: false, | |
| boundaryMargin: EdgeInsets.all(80), | |
| onInteractionStart: (details) { | |
| model.setInteraction(true); |