This file contains 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
syntax="proto3"; | |
message Student { | |
int32 id = 1; | |
string name = 2; | |
} | |
message Question { | |
int32 id = 1; | |
string text = 2; |
This file contains 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 'package:flutter/material.dart'; | |
abstract class ScreenSize { | |
static Size size(BuildContext context) { | |
return MediaQuery.of(context).size; | |
} | |
static double height(BuildContext context, | |
{double dividedBy = 1, double reducedBy = 0.0}) { | |
return (ScreenSize.size(context).height - reducedBy) / dividedBy; |
This file contains 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
### Flutter Generated | |
# Miscellaneous | |
*.class | |
*.lock | |
*.log | |
*.pyc | |
*.swp | |
.DS_Store | |
.atom/ |
This file contains 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
# add path example | |
echo 'export PATH="$PATH:/usr/lib/dart/bin"' >> ~/.bashrc | |
source .bashrc | |
# install dart https://www.dartlang.org/tools/sdk#install |
This file contains 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 CounterState { | |
final int counter; | |
CounterState._(this.counter); | |
factory CounterState.nextState(int times) => CounterState._(times); | |
} | |
class CounterBloc extends Bloc<CounterEvent, CounterState> { | |
@override | |
CounterState get initialState => CounterState.nextState(0); |
This file contains 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
<templateSet group="user"> | |
<template name="imf" value="import 'package:flutter/material.dart';" description="Import flutter material" toReformat="false" toShortenFQNames="true"> | |
<context> | |
<option name="DART" value="true" /> | |
</context> | |
</template> | |
<template name="fblo" value="import 'dart:async'; import 'package:bloc/bloc.dart'; class $name$Bloc extends Bloc<$event$, $state$> { @override $name$State get initialState => null; @override Stream<$name$State> mapEventToState($state$ currentState, $event$ event) { $cursor$ return null; } }" description="flutter bloc class template" toReformat="false" toShortenFQNames="true"> | |
<variable name="name" expression="" defaultValue="" alwaysStopAt="true" /> | |
<variable name="event" expression="" defaultValue="" alwaysStopAt="true" /> | |
<variable name="state" expression="" defaultValue="" alwaysStopAt="true" /> |
This file contains 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
extension String { | |
subscript (i: Int) -> String? { | |
if characters.count > i && i >= 0 { | |
return String(Array(self.characters)[i]) | |
} | |
return nil | |
} | |
subscript (r: Range<Int>) -> String? { |
This file contains 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
@Override | |
public boolean onOptionsItemSelected(MenuItem item) { | |
switch (item.getItemId()) { | |
case android.R.id.home: | |
Toast.makeText(getApplicationContext(),"Back button clicked", Toast.LENGTH_SHORT).show(); | |
break; | |
} | |
return true; | |
} |
This file contains 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
// Needed in AndroidManifest: | |
<!-- Permission for using NFC hardware --> | |
<uses-permission android:name="android.permission.NFC"/> | |
<!-- Forcing device to have NFC hardware --> | |
<uses-feature android:name="android.hardware.nfc" android:required="true"/> | |
<!-- Registering app for receiving NFC's TAG_DISCOVERED intent --> | |
<intent-filter> | |
<action android:name="android.nfc.action.TAG_DISCOVERED"/> | |
<category android:name="android.intent.category.DEFAULT"/> | |
</intent-filter> |