Skip to content

Instantly share code, notes, and snippets.

@ThrowJojo
ThrowJojo / main.dart
Created May 31, 2021 22:36
A rounded ElevatedButton.
import 'package:flutter/material.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
@ThrowJojo
ThrowJojo / main.dart
Created May 26, 2021 23:00
Some tasty fruit
import 'package:flutter/material.dart';
enum Fruit {
apple,
orange,
banana,
}
extension FruitExt on Fruit {
Color get color {
@ThrowJojo
ThrowJojo / main.dart
Created May 1, 2021 00:15
An example of ScrollController.
import 'package:flutter/material.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
print(Colors.black.hashCode.toString());
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@ThrowJojo
ThrowJojo / main.dart
Created January 5, 2021 23:13
Merging two Providers together(Riverpod)
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/all.dart';
void main() {
runApp(
ProviderScope(
child: MyApp()
)
);
@ThrowJojo
ThrowJojo / main.dart
Created January 3, 2021 01:50
A Flutter counter app using hooks_riverpod and flutter_hooks
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/all.dart';
void main() {
runApp(
ProviderScope(
child: MyApp()
)
);
@ThrowJojo
ThrowJojo / Share.m
Created April 23, 2018 00:44
Sharing on LINE.
- (void) shareOnLine: (NSString*) text {
NSString *encodedText = [text stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLHostAllowedCharacterSet]];
NSString *urlString = [NSString stringWithFormat:@"line://msg/text/%@", encodedText];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString] options:@{} completionHandler:^(BOOL success) {
// Do something on completion
}];
}
@ThrowJojo
ThrowJojo / ExampleFragment.kt
Created April 13, 2018 01:27
Example of RecyclerView + onScrollListener
class ExampleFragment : Fragment() {
var loading = false
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_example, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
@ThrowJojo
ThrowJojo / component.js
Created April 6, 2018 00:21
Go back twice.
this.props.history.go(-2);
@ThrowJojo
ThrowJojo / component.js
Created April 6, 2018 00:20
Go back once again.
this.props.history.go(-1);
@ThrowJojo
ThrowJojo / component.js
Created April 6, 2018 00:18
Go back once.
this.props.history.goBack();