This code is a direct copy of the code found on the Express.js site under Getting Started. I just followed installing and hello world from there to get a basic server up and running.
(index.js file
)
This code is a direct copy of the code found on the Express.js site under Getting Started. I just followed installing and hello world from there to get a basic server up and running.
(index.js file
)
import 'dart:ui' as ui; | |
import 'package:flutter/foundation.dart'; | |
import 'package:flutter/painting.dart'; | |
// sample code | |
/* | |
class CornerDecorationTest extends StatefulWidget { | |
@override | |
_CornerDecorationTestState createState() => _CornerDecorationTestState(); | |
} |
import android.app.Activity | |
import android.graphics.Rect | |
import android.os.Build | |
import android.view.View | |
import android.view.ViewTreeObserver | |
import android.view.inputmethod.InputMethodManager | |
/** | |
* Created by mikepenz on 14.03.15. | |
* This class implements a hack to change the layout padding on bottom if the keyboard is shown |
import 'package:flutter/foundation.dart'; | |
import 'dart:io'; | |
bool get isWeb => kIsWeb; | |
bool get isMobile => !isWeb && (Platform.isIOS || Platform.isAndroid); | |
bool get isDesktop => | |
!isWeb && (Platform.isMacOS || Platform.isWindows || Platform.isLinux); | |
bool get isApple => !isWeb && (Platform.isIOS || Platform.isMacOS); | |
bool get isGoogle => !isWeb && (Platform.isAndroid || Platform.isFuchsia); |
It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.
// Apache 2.0 licensed. | |
import android.content.Context; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.BaseAdapter; | |
/** An implementation of {@link BaseAdapter} which uses the new/bind pattern for its views. */ | |
public abstract class BindableAdapter<T> extends BaseAdapter { |
This is an ad-hoc Java-to-Dart translator originally written on two (admittedly long) evenings.
See http://sma.github.io/stuff/java2dartweb/java2dartweb.html for a demo.
Note: It doesn't support the complete Java grammar specification and cannot translate everything. It only translates syntax and does not attempt to translate Java library classes and methods to Dart equivalents (with the exception of String.charAt
and StringBuffer.append
). You will have to make changes to the resulting Dart code. It does not support anonymous inner classes.
However, I was able to successfully convert a 7000+ line command line application with only minimal fixes in 30 minutes.
#!/bin/sh | |
# License for any modification to the original (linked below): | |
# ---------------------------------------------------------------------------- | |
# "THE BEER-WARE LICENSE" (Revision 42): | |
# Sebastiano Poggi wrote this file. As long as you retain | |
# this notice you can do whatever you want with this stuff. If we meet some day, | |
# and you think this stuff is worth it, you can buy us a beer in return. | |
#### SETUP/USAGE INSTRUCTIONS #### |
public static void postNewComment(Context context,final UserAccount userAccount,final String comment,final int blogId,final int postId){ | |
mPostCommentResponse.requestStarted(); | |
RequestQueue queue = Volley.newRequestQueue(context); | |
StringRequest sr = new StringRequest(Request.Method.POST,"http://api.someservice.com/post/comment", new Response.Listener<String>() { | |
@Override | |
public void onResponse(String response) { | |
mPostCommentResponse.requestCompleted(); | |
} | |
}, new Response.ErrorListener() { | |
@Override |