Skip to content

Instantly share code, notes, and snippets.

View StanislawNagorski's full-sized avatar

Stanisław Nagórski StanislawNagorski

View GitHub Profile
import 'dart:developer';
import 'package:flutter/widgets.dart';
class AppLifeCycleWidgetWrapper extends StatefulWidget {
const AppLifeCycleWidgetWrapper({
required this.child,
this.onMoveToForeground,
this.onMoveToBackground,
this.onAppPaused,
@StanislawNagorski
StanislawNagorski / on_off_button.dart
Last active November 14, 2022 20:40
Button with 3 states: ON, OFF, DISABLE
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import '../presentation/values/values.dart';
class TextToggleOnOffButton extends HookWidget {
const TextToggleOnOffButton({
required this.buttonContent,
required this.onToggleOn,
required this.backgroundColor,
@StanislawNagorski
StanislawNagorski / enums_on_duty_to_clean_presentation.dart
Last active January 9, 2023 10:17
enums_on_duty_to_clean_presentation
enum Game {
tekken(
nameTranslationKey: SKeys.game_name_tekken,
gameSize: GameSize.large,
iconPath: AppImages.gameLogoTekken,
requiresPass: true,
),
pokemon_blue(
nameTranslationKey: SKeys.game_name_pokemon_blue,
gameSize: GameSize.large,
const String _mockDataJson = 'assets/mock_data/events_spots_localization_mock_data.json';
const int _mockCallMillisecondsDuration = 500;
@Injectable(
as: RemoteDataSourceMock,
env: [Flavor.DEVELOP, Flavor.STAGE],
)
class RemoteDataSourceMock implements RemoteDataSource {
@override
Future<List<DataModel>> getData({required GeoPoint userLocation}) async =>
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import '../presentation/styles/styles.dart';
const _defaultFit = BoxFit.fill;
const _defaultAlignment = Alignment.center;
const _defaultTextStyle = TextStyles.buttonBlack;
class TextWithChangingBackgroundButton extends HookWidget {
@StanislawNagorski
StanislawNagorski / color_string_parser.dart
Last active July 11, 2022 11:03
Color parser to and from #hex String
import 'dart:ui';
//creates hexString like #C6DEE5
extension ColorExtension on Color{
String toHexString() {
final hex = value.toRadixString(16).toUpperCase();
return hex.replaceFirst('FF','#');
}
}