diff --git a/ohos/src/main/ets/toast/MethodCallHandlerImpl.ets b/ohos/src/main/ets/toast/MethodCallHandlerImpl.ets index 20c975600d467e82fc759f50e36d91a5164bbe1d..386adea47dc094388bd5d66fffa8036ee21508c2 100644 --- a/ohos/src/main/ets/toast/MethodCallHandlerImpl.ets +++ b/ohos/src/main/ets/toast/MethodCallHandlerImpl.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import promptAction from '@ohos.promptAction' +import { promptAction } from '@kit.ArkUI'; import { MethodCallHandler, MethodResult } from '@ohos/flutter_ohos/src/main/ets/plugin/common/MethodChannel'; import MethodCall from '@ohos/flutter_ohos/src/main/ets/plugin/common/MethodCall'; @@ -33,7 +33,10 @@ export default class MethodCallHandlerImpl implements MethodCallHandler{ let textSize: number = call.argument("fontSize"); try { - promptAction.showToast({message: msg, duration: time}); + promptAction.showToast({ + message: msg, duration: time, + alignment: gravity == "center" ? Alignment.Center : gravity == "top" ? Alignment.Top : undefined, + }); } catch (e) { Log.e(TAG, "Show toast err " + e); }